diff --git a/CHANGELOG.md b/CHANGELOG.md index 9850913..9f2ede3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,22 @@ All notable changes to the [Unity3D NuGet package](https://www.nuget.org/package The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 3.0.0 - 2023-12-04 + +Download from [GitHub Releases](https://github.com/Rabadash8820/UnityAssemblies/releases/tag/v3.0.0) or [nuget.org](https://www.nuget.org/packages/Unity3D/3.0.0). + +### Changed in 3.0.0 + +- All Unity module assemblies are now referenced by default (including the one named `UnityEngine.dll`), rather than the monolithic `UnityEngine.dll`, + so projects don't have to remove the default references in order to work with UPM package assemblies. +- Default references can be easily toggled off by setting the `IncludeDefaultUnityAssemblyReferences` property to `False` +- All short-hand properties and default references are now added by a `.targets` file rather than `.props`, + removing the need to move `UnityVersion` and/or `UnityProjectPath` property definitions to a `Directory.Build.props` file + +### Removed in 3.0.0 + +- `UnityAnalyticsStandardEvents*` MSBuild properties for Unity 2020.3+ projects, since those paths have never existed on those Unity versions + ## 2.1.3 - 2023-08-16 Download from [GitHub Releases](https://github.com/Rabadash8820/UnityAssemblies/releases/tag/v2.1.3) or [nuget.org](https://www.nuget.org/packages/Unity3D/2.1.3). diff --git a/README.md b/README.md index 14b2d5f..a1f12a1 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![NuGet package](https://img.shields.io/nuget/v/Unity3D.svg)](https://nuget.org/packages/Unity3D) [![NuGet downloads](https://img.shields.io/packagecontrol/dd/Unity3D.svg)](https://nuget.org/packages/Unity3D) -[![Changelog (currently v2.1.3)](https://img.shields.io/badge/changelog-v2.1.3-blue.svg)](./CHANGELOG.md) +[![Changelog (currently v3.0.0-rc1)](https://img.shields.io/badge/changelog-v3.0.0-rc1-blue.svg)](./CHANGELOG.md) [![License](https://img.shields.io/github/license/Rabadash8820/UnityAssemblies.svg)](./LICENSE) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](./CODE_OF_CONDUCT.md) [![Issues closed](https://img.shields.io/github/issues-closed/Rabadash8820/UnityAssemblies)](https://github.com/Rabadash8820/UnityAssemblies/issues) @@ -31,6 +31,7 @@ _Unity® and the Unity logo are trademarks of Unity Technologies._ See full usage docs for the version of this NuGet package that you're using: +- [3.x](docs/v3/usage.md) - [2.x](docs/v2/usage.md) - [1.x](https://github.com/Rabadash8820/UnityAssemblies/blob/v1.7.0/README.md) (deprecated and no longer maintained) diff --git a/docs/v3/faq.md b/docs/v3/faq.md new file mode 100644 index 0000000..dc1c301 --- /dev/null +++ b/docs/v3/faq.md @@ -0,0 +1,52 @@ +# Unity3D v2 - FAQ + +- [Usage](./usage.md) +- [Available Short-Hand Properties](./short-hand-properties.md) +- -> FAQ + +1. **Why would I use this NuGet package?** + The primary, intended use case for this NuGet is for Unity developers writing [managed plugins](https://docs.unity3d.com/Manual/UsingDLL.html) + (pre-compiled DLLs that will be imported into Unity) that also depend on Unity APIs. + It allows developers to reference the Unity assemblies via `Reference` items in their project files, just like they might reference any other NuGet package or local assembly, + without having to remember Unity's assembly paths or keep them up-to-date and cross-platform. + With the option to [use Unity as a library](https://blogs.unity3d.com/2019/06/17/add-features-powered-by-unity-to-native-mobile-apps/) in 2019.3+, + developers might also use this package in native mobile apps created with [Xamarin](https://dotnet.microsoft.com/apps/xamarin), + or in really any library or executable that needs access to the Unity APIs. +1. **How does this work?** + This NuGet package [imports an MSBuild .targets file](https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package#including-msbuild-props-and-targets-in-a-package) into your project, + which adds the various properties and `Reference` items at build time. + The Unity version can be set via a `UnityVersion` MSBuild property or + parsed from the `ProjectVersion.txt` file of the Unity project at `UnityProjectPath` (using `File.ReadAllText`) + in an [MSBuild static property function](https://docs.microsoft.com/en-us/visualstudio/msbuild/property-functions?static-property-functions). +1. **Are the `Reference` paths really cross-platform?** + Yes, but only paths that begin with the default `$(OSInstallRootPath)` and `$(UnityInstallRootPath)` properties, or with a custom relative or cross-platform base path that you define. + This works through a magical little combination of [MSBuild Conditions](https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-conditions) + and the [`IsOsPlatform()` Property Function](https://docs.microsoft.com/en-us/visualstudio/msbuild/property-functions#msbuild-property-functions). +1. **Is this package officially maintained by Unity Technologies?** + No, it is maintained by [one wild and crazy guy](https://github.com/Rabadash8820). + However, this package will be submitted to Unity Technologies as it gains traction, + **_so that maybe we can finally have an officially supported NuGet package for Unity assemblies!_** +1. **If not, how is this package legal?** + Well, it's not actually distributing the Unity assembly binaries, just MSBuild files that reference them. + This NuGet package won't do anything (except add some build warnings) if you haven't actually installed a version of Unity on your machine. +1. **Can you help me solve [error] in Unity [version]?** + Possibly. Compatibility is only tested with, and support offered for, the latest Unity [LTS releases](https://unity3d.com/unity/qa/lts-releases) and the TECH stream releases of the current year. + Unity does not officially support versions older than that, so neither does this package! + That said, if you're having an issue with an older version of Unity, there's a good chance that someone in this community has seen it before, + so feel free to [open an Issue](https://github.com/Rabadash8820/UnityAssemblies/issues)! +1. **With which Unity versions has this package been officially tested?** + In the following: + - Unity 6 Beta + - 2023.2, 2023.1 + - 2022.3 LTS, 2022.2, 2022.1 + - 2021.3 LTS, 2021.2, 2021.1 + - 2020.3 LTS, 2020.1 + - 2019.4 LTS + - 2018.4 LTS +1. **Can I use this package in my CI/CD Pipeline?** + Most likely, [yes](./usage.md#cicd-pipelines)! +1. **Why hasn't this repository been updated since [date]?** + This NuGet package is very simple, with most of its functionality contained in a [single file](../../nupkg/build/Unity3D.targets). + Between that, and the package's use of forward-compatible properties like `UnityVersion` that can be tweaked at design time, + this repository simply does not require frequent updates. + Most changes going forward will be to add more short-hand properties, and to add test projects for new versions of Unity. diff --git a/docs/v3/short-hand-properties.md b/docs/v3/short-hand-properties.md new file mode 100644 index 0000000..c8d5c87 --- /dev/null +++ b/docs/v3/short-hand-properties.md @@ -0,0 +1,80 @@ +# Unity3D v2 - Available Short-Hand Properties + +- [Usage](./usage.md) +- -> Available Short-Hand Properties +- [FAQ](./faq.md) + +Note that, unless otherwise noted, _any_ of the following properties can be overwritten by setting the property manually in your MSBuild project files. +For example, to change the UI assembly's path, you could set: + +```xml +path\to\UnityEngine.UI.dll +``` + +As assembly paths change in future versions of Unity, you can continue referencing them by overwriting these properties, until the properties are updated in this package. +This ability makes this NuGet package truly "forward-compatible". +You can manually override the property for a single assembly (e.g., `UnityEnginePath`), +or for many assemblies under the same absolute/relative base path (e.g., `UnityModulesPath` or `UnityModulesDir`). + +Generally, properties named `*Path` are absolute paths, and properties named `*Dir` or `*Assembly` are relative paths. +Most assembly path properties (e.g., `UnityPackageCachePath`) are a combination of a relative path property (e.g., `UnityPackageCacheDir`) +and a base path, which might use another short-hand property. +Through clever use of these properties, you can even reference assemblies from more than one Unity project. +You might do this if you wanted to reference an assembly at the same relative path in two different Unity projects under different conditions. +You could use the same _relative_ short-hand property in both cases, but set the base path conditionally. + +The assembly paths under the `Library/PackageCache` folder use the `*` wildcard. +This spares you from hard-coding a UPM package version and updating it every time you update the package in Unity's Package Manager window. +Unity only stores one version of a Package in the `PackageCache` folder, so you don't need to worry about multiple versions of the same Package being referenced by the wildcard. +When adding references to other UPM package assemblies, you should precede the `*` wildcard with `%40` +(an [MSBuild-escaped](https://learn.microsoft.com/en-us/visualstudio/msbuild/how-to-escape-special-characters-in-msbuild#to-use-an-msbuild-special-character-as-a-literal-character) `@` character) +to prevent conflicts with "sub-namespace" assembly names. +For example, you could reference both `org.nuget.microsoft.extensions.logging%40*\Microsoft.Extensions.Logging.dll` and +`org.nuget.microsoft.extensions.logging.abstractions%40*\Microsoft.Extensions.Logging.Abstractions.dll`, without the former's wildcard overwriting the latter. + +**Note: It is worth repeating that, unless otherwise noted, _any_ of these properties can be manually overridden.** + +| Property | Default value | Comments | +|:---------|:--------------|:---------| +| `OSInstallRootPath` | `C:\Program Files` on Windows, `/Application` on MacOS, or `/home/` on Linux. | | +| `UnityVersionMajor` | 0 | Major version parsed from `UnityVersion` (e.g., `2021` from `2021.3.5f1`). Cannot be overriden. | +| `UnityVersionMinor` | 0 | Minor version parsed from `UnityVersion` (e.g., `3` from `2021.3.5f1`). Cannot be overriden. | +| `UnityVersionPatch` | 0 | Patch version parsed from `UnityVersion` (e.g., `5f1` from `2021.3.5f1`). Cannot be overriden. | +| `UnityVersionAsNumber` | 0.0 | Equals `$(UnityVersionMajor).$(UnityVersionMinor)`. Cannot be overriden. Useful for making numeric comparisons against the Unity version in MSBuild Conditions. | +| `UnityInstallRootDir` | `Unity\Hub\Editor` | Referenced by `UnityInstallRootPath`. | +| `UnityInstallRootPath` | `$(OSInstallRootPath)\$(UnityInstallRootDir)` | | +| `UnityVersionInstallPath` | `$(UnityInstallRootPath)\$(UnityVersion)` | | +| `UnityManagedDir` | `Editor\Data\Managed` on Linux/Windows or `Unity.app\Contents\Managed` on MacOS. | Referenced by `UnityManagedPath`. | +| `UnityManagedPath` | `$(UnityVersionInstallPath)\$(UnityManagedDir)` | | +| `UnityExtensionsDir` | `Editor\Data\UnityExtensions\Unity` on Linux/Windows or `Unity.app\Contents\UnityExtensions\Unity` on MacOS. | Referenced by `UnityExtensionsPath`. | +| `UnityExtensionsPath` | `$(UnityVersionInstallPath)\$(UnityExtensionsDir)` | | +| `UnityModulesDir` | `UnityEngine` | Referenced by `UnityModulesPath`. | +| `UnityModulesPath` | `$(UnityManagedPath)\$(UnityModulesDir)` | This folder contains assemblies for Unity's core modules like the Audio, Animation, and ParticleSystem modules. References to those assemblies are added by default in version 2.2.0+. See [instructions for removing them](./usage.md#removing-the-default-references). | +| `UnityPlaybackEnginesDir` | `Editor\Data\PlaybackEngines` | Referenced by `UnityPlaybackEnginesPath`. | +| `UnityPlaybackEnginesPath` | `$(UnityVersionInstallPath)\$(UnityPlaybackEnginesDir)` | This folder contains target-platform-specific assemblies, e.g. those for iOS/Android. | +| `UnityAndroidPlayerDir` | `$(UnityPlaybackEnginesDir)\AndroidPlayer` | Referenced by `UnityAndroidPlayerPath`. | +| `UnityAndroidPlayerPath` | `$(UnityVersionInstallPath)\$(UnityAndroidPlayerDir)` | | +| `UnityiOSSupportDir` | `$(UnityPlaybackEnginesDir)\iOSSupport` | Referenced by `UnityiOSSupportPath`. | +| `UnityiOSSupportPath` | `$(UnityVersionInstallPath)\$(UnityiOSSupportDir)` | | +| `UnityScriptAssembliesDir` | `Library\ScriptAssemblies` | Referenced by `UnityScriptAssembliesPath`. | +| `UnityScriptAssembliesPath` | `$(UnityProjectPath)\$(UnityScriptAssembliesDir)` | | +| `UnityBuiltInPackagesDir` | `Editor\Data\Resources\PackageManager\BuiltInPackages` | Referenced by `UnityBuiltInPackagesPath`. Only defined if `UnityVersion` is >= 2017.2. | +| `UnityBuiltInPackagesPath` | `$(UnityVersionInstallPath)\$(UnityBuiltInPackagesDir)` | This folder contains assemblies from Unity's built-in Packages, like IMGUI and TerrainPhysics (for all other UPM Package assemblies, see `UnityPackageCachePath`). Only defined if `UnityVersion` is >= 2017.2. | +| `UnityProjectPath` | N/A | This property has no default value. Set it to the absolute path of the root folder of your Unity project, so that you can easily reference Package and Asset Store assemblies (as [described above](./usage.md#referencing-assemblies-stored-in-a-unity-project)). | +| `UnityPackageCacheDir` | `Library\PackageCache` | Referenced by `UnityPackageCachePath`. Only defined if `UnityVersion` is >= 2017.2. | +| `UnityPackageCachePath` | `$(UnityProjectPath)\$(UnityPackageCacheDir)` | This folder contains assemblies from UPM packages (for built-in Packages, see `UnityBuiltInPackagesPath`). Only defined if `UnityVersion` is >= 2017.2. | +| `UnityEnginePath` | `$(UnityManagedPath)\UnityEngine.dll` | This reference is added by default in versions 2.1.3 and below. See [instructions to remove it](./usage.md#removing-the-default-references). | +| `UnityEditorPath` | `$(UnityManagedPath)\UnityEditor.dll` | | +| `UnityEngineUIPath` | `$(UnityScriptAssembliesPath)\UnityEngine.UI.dll` for Unity 2019.3+, `$(UnityExtensionsPath)\GUISystem\UnityEngine.UI.dll` for Unity 2019.2 and below | | +| `UnityEngineTestRunnerPath` | `$(UnityScriptAssembliesPath)\UnityEngine.TestRunner.dll` for Unity 2019.3+, `$(UnityExtensionsPath)\TestRunner\UnityEngine.TestRunner.dll` for Unity 2019.2 and below | | +| `UnityEditorAndroidExtensionsPath` | `$(UnityAndroidPlayerPath)\UnityEditor.Android.Extensions.dll` | See types under `UnityEditor > UnityEditor.Android` in the [Unity Scripting API docs](https://docs.unity3d.com/ScriptReference/index.html) | +| `UnityEditoriOSExtensionsCommonPath` | `$(UnityiOSSupportPath)\UnityEditor.iOS.Extensions.Common.dll` | See types under `UnityEditor > UnityEditor.iOS` in the [Unity Scripting API docs](https://docs.unity3d.com/ScriptReference/index.html) | +| `UnityEditoriOSExtensionsXcodePath` | `$(UnityiOSSupportPath)\UnityEditor.iOS.Extensions.Xcode.dll` | See types under `UnityEditor > UnityEditor.iOS` in the [Unity Scripting API docs](https://docs.unity3d.com/ScriptReference/index.html) | +| `NewtonsoftJsonAssembly` | `com.unity.nuget.newtonsoft-json%40*\Runtime\Newtonsoft.Json.dll` | Requires installation of the [Performance Testing Extension](https://docs.unity3d.com/Packages/com.unity.test-framework.performance@latest/index.html) for Unity Test Runner package. Referenced by `NewtonsoftJsonPath`. Only defined if `UnityVersion` is between 2019.3 and 2022.1, inclusive. | +| `NewtonsoftJsonPath` | `$(UnityPackageCachePath)\$(NewtonsoftJsonAssembly)` for Unity 2019.3-2022.1, `$(UnityManagedPath)\Newtonsoft.Json.dll` for Unity 2022.2+ | In Unity 2019.3-2022.1, requires installation of the [Performance Testing Extension](https://docs.unity3d.com/Packages/com.unity.test-framework.performance@latest/index.html) for Unity Test Runner package. No extra installations required in Unity 2022.2+. | +| `NunitAssembly` | `com.unity.ext.nunit%40*\net35\unity-custom\nunit.framework.dll` | Requires installation of the [Test Framework](https://docs.unity3d.com/Packages/com.unity.test-framework@latest/index.html) package. Referenced by `NunitPath`. Only defined if `UnityVersion` is >= 2019.2. | +| `NunitPath` | `$(UnityPackageCachePath)\$(NunitAssembly)` | Requires installation of the [Test Framework](https://docs.unity3d.com/Packages/com.unity.test-framework@latest/index.html) package. Only defined if `UnityVersion` is >= 2019.2. | +| `MoqAssembly` | `nuget.moq%40*\Moq.dll` | Requires installation of the [Test Framework](https://docs.unity3d.com/Packages/com.unity.test-framework@latest/index.html) package. In Unity 2020.1+, [download Moq from NuGet](https://www.nuget.org/packages/moq/) and import it as a managed plugin. Referenced by `MoqPath`. Only defined if `UnityVersion` is between 2019.2 and 2019.3, inclusive. | +| `MoqPath` | `$(UnityPackageCachePath)\$(MoqAssembly)` | Requires installation of the [Test Framework](https://docs.unity3d.com/Packages/com.unity.test-framework@latest/index.html) package. In Unity 2020.1+, [download Moq from NuGet](https://www.nuget.org/packages/moq/) and import it as a managed plugin. Only defined if `UnityVersion` is between 2019.2 and 2019.3, inclusive. | +| `UnityAnalyticsStandardEventsAssembly` | `com.unity.analytics%40*\AnalyticsStandardEvents\Unity.Analytics.StandardEvents.dll` | Requires installation of the [legacy Analytics Library](https://docs.unity3d.com/Packages/com.unity.analytics@latest/index.html) package. Referenced by `UnityAnalyticsStandardEventsPath`. Only defined if `UnityVersion` is between 2019.2 and 2020.2, inclusive. | +| `UnityAnalyticsStandardEventsPath` | `$(UnityPackageCachePath)\$(UnityAnalyticsStandardEventsAssembly)` | Requires installation of the [legacy Analytics Library](https://docs.unity3d.com/Packages/com.unity.analytics@latest/index.html) package. Only defined if `UnityVersion` is between 2019.2 and 2020.2, inclusive. | diff --git a/docs/v3/usage.md b/docs/v3/usage.md new file mode 100644 index 0000000..75b456d --- /dev/null +++ b/docs/v3/usage.md @@ -0,0 +1,294 @@ +# Unity3D v2 - Usage + +- -> Usage + - [Basic Usage](#basic-usage) + - [Editing the project files](#editing-the-project-files) + - [Choosing a `TargetFramework`](#choosing-a-targetframework) + - [Referencing additional Unity assemblies](#referencing-additional-unity-assemblies) + - [Referencing assemblies stored in a Unity project](#referencing-assemblies-stored-in-a-unity-project) + - [Referencing assemblies at non-default install locations](#referencing-assemblies-at-non-default-install-locations) + - [Removing the default reference to UnityEngine.dll](#removing-the-default-reference-to-unityenginedll) + - [Referencing the Unity core modules](#referencing-the-unity-core-modules) + - [Referencing assemblies in specific Unity versions](#referencing-assemblies-in-specific-unity-versions) + - [CI/CD Pipelines](#cicd-pipelines) +- [Available Short-Hand Properties](./short-hand-properties.md) +- [FAQ](./faq.md) + +## Basic Usage + +[Install this package](https://docs.microsoft.com/en-us/nuget/consume-packages/overview-and-workflow#ways-to-install-a-nuget-package) +then add lines like the following to your .csproj file (or any imported MSBuild project file). + +```xml + + + $(MSBuildProjectDirectory)\relative\path\to\UnityProject + + 2023.2.20f1 + + +``` + +This satisfies the large majority of use cases. For more advanced setups, read on. + +As shown in that basic example, this package only requires a `UnityVersion` or `UnityProjectPath` property to be up and running. +`UnityVersion` must be a complete version string, in the format used by Unity Hub (the values boxed in red in the screenshot below). + +![Unity version strings highlighted in the Unity Hub interface](../../images/unity-versions.png) + +If you're working with a specific Unity project, then the recommendation is to set `UnityProjectPath` instead of `UnityVersion`. +This NuGet package will then look up the project's Unity version from its `ProjectSettings/ProjectVersion.txt` file, +so that when you update the project to a new Unity version, your assembly references will also update. +`UnityProjectPath` must be the path to a Unity project folder, _not the `Assets/` subfolder_. +Try to define the path relative to the MSBuild project's directory (i.e., relative to `$(MSBuildProjectDirectory)`) so that it resolves across platforms. +This works especially well when your MSBuild (Visual Studio) project and Unity project are in the same repository. +If both `UnityVersion` and `UnityProjectPath` are provided, then the explicit version will take precedence. +If you do not set `UnityVersion` _or_ `UnityProjectPath`, then `UnityVersion` will default to the constant string `"SET_VERSION_OR_PROJECT"`. +If you see this string in the paths of assembly references in your IDE, then the properties are missing or inaccessible to this NuGet package. + +## Editing the project files + +To edit a project file in Visual Studio: + +- **When targeting .NET Standard (recommended):** just double-click on the project in the Solution Explorer +- **When targeting .NET 4.x:** right click on the project in the Solution Explorer, click `Unload project`, then right click again to select `Edit .csproj`. + When you're done editing the file, right click on the project again and select `Reload project`. Having to unload the project before editing can be cumbersome, + so check out this excellent [article by Scott Hanselman](https://www.hanselman.com/blog/UpgradingAnExistingNETProjectFilesToTheLeanNewCSPROJFormatFromNETCore.aspx) + for instructions on migrating to the newer, leaner SDK syntax of .NET Standard. + +## Choosing a `TargetFramework` + +For new projects, you should use the modern "SDK-style" .csproj files, which have a root `` element rather than ``. +This style yields smaller, more readable project files, and simplifies portability with projects built against other .NET runtimes. +You should then use one of the following .NET Standard `TargetFramework`s: + +- For Unity 2021.2+, use `netstandard2.1` +- For Unity 2021.1 and below, use `netstandard2.0` + +If, however, you are working with an existing, older project, then you may be forced to use one of the following .NET 4.x `TargetFramework`s: + +- For Unity 2021.2+, use `net48` : +- For Unity 2020.2 - 2021.1, use `net472` +- For Unity 2020.1 and below, use `net461` + +If you don't, you will see errors like: + +> The primary reference ... could not be resolved because it has an indirect dependency on the assembly ... +which was built against the ".NETFramework,Version=v4.[x]" framework. +This is a higher version than the currently targeted framework ".NETFramework,Version=v4.[y]". + +## Referencing additional Unity assemblies + +By default, this package only adds a reference to the core Unity modules (essentially, the types in `UnityEngine.dll`). +However, there are several other Unity assemblies that your project might need to reference. +These include `UnityEditor.dll` for writing custom editors, or `UnityEngine.UI.dll` for referencing UI types like `Text` and `Button`. +To reference these assemblies, add `Reference` items to your `.csproj`, like so: + +```xml + + + +``` + +Note the use of a `*Path` MSBuild property. +These properties spare you from remembering the default Unity install paths or the relative paths to any Unity assemblies, +and they also let the references work across platforms (Windows/MacOS/Linux). +See below for the full list of [provided short-hand properties](./short-hand-properties.md). + +Also note the use of [`Private="false"`](https://docs.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-project-items#reference). +This basically means "don't copy the referenced assembly to the output folder". +This is recommended so that Unity assemblies aren't being copied around unnecessarily, since they're automatically linked with managed plugins inside the Unity Editor. + +If you want to reference a Unity assembly for which there is no short-hand property, you can just hard-code its path into a `` item yourself. +If it is one of Unity's built-in assemblies, then the path should start with `$(UnityInstallRoot)\$(UnityVersion)\`, +so that it resolves across platforms, and so you're not duplicating the Unity version in multiple paths. +If it is an assembly under your `UnityProjectPath` then see the next section. + +## Referencing assemblies stored in a Unity project + +You may need to reference assemblies stored in a Unity project folder (i.e., under `Assets/` or `Library/`). +This is especially common when your code and Unity project are stored in the same repository, +and you want to reference assemblies from Asset Store assets or Packages that you've installed. +In these cases, the paths in your `Reference` items should be relative paths, so that they resolve across platforms. +When you define an MSBuild property named `$(UnityProjectPath)` to store this relative path, you can use it as a short-hand for multiple `Reference`s. +Moreover, there are a [couple short-hand properties](./short-hand-properties.md) that refer to common assembly paths under `UnityProjectPath`. +For example, if you wanted to consume uGUI types like `Button` or `Text` +_and_ use the [Addressables](https://3d.com/Manual/com.unity.addressables.html) workflow, +then your `.csproj` would look something like this: + +```xml + + + $(MSBuildProjectDirectory)\relative\path\to\UnityProject + + + + + + +``` + +**Note: the Unity project must have been opened recently, so that the `Library/` folder actually contains the imported assemblies!** + +Also note that, while there are short-hand properties for a couple assemblies under the `PackageCache` folder (see the [full list](./short-hand-properties.md)), +there are _no_ short-hand properties for assemblies stored in the `ScriptAssemblies` folder. +That folder is completely flat, so you can just reference assemblies there by filename. + +## Referencing assemblies at non-default install locations + +Because Unity Hub is the installation tool [recommended by Unity Technologies](https://3d.com/Manual/GettingStartedInstallingUnity.html), +this package checks for Unity assemblies at Unity Hub's default install locations by default. +If you are not using Unity Hub, or are using non-default install locations, then you can override the path where this package searches for Unity assemblies +by setting the `UnityInstallRootPath` and/or `OSInstallRootPath` MSBuild properties. +See the [list of short-hand properties](./short-hand-properties.md) to understand these properties' default values and how they are interpreted. + +For example, if you were using a Windows machine and you installed a Unity version without Unity Hub on your `V:` drive, +or set the "Installs location" to your `V:` drive in Unity Hub preferences, then you would need the following MSBuild code: + +```xml + + V:\ + + +``` + +On collaborative projects, hard-coding paths is insufficient, as contributors may be using a mixture of default and non-default install locations. +To support user-specific Unity install locations, you can use MSBuild [property functions](https://learn.microsoft.com/en-us/visualstudio/msbuild/property-functions) +in your version-controlled `UnityInstallRoot[Path]` and/or `OSInstallRoot[Path]` properties. +For example, you could read the path from a `UNITY_OS_INSTALL_ROOT` environment variable. Each collaborator would need to define that variable on their machine. +Then, your versioned MSBuild property would be: + +```xml +$([System.Environment]::GetEnvironmentVariable('UNITY_OS_INSTALL_ROOT')) +``` + +**Warning: If your property function returns `null` or an empty string (e.g., if a collaborator did _not_ set the required environment variable), +then this package still uses the default `UnityInstallRoot[Path]` and/or `OSInstallRoot[Path]`.** + +## Removing the default references + +You may not want to keep the default Unity assembly references added by this NuGet package. +E.g., you may only need a reference to some other Unity assembly or want to reference individual Unity module assemblies explicitly. +To remove the references from your project, simply add the following line to a `` in your MSBuild project file(s): + +```xml +False +``` + +## Referencing the Unity core modules + +`UnityEngine.dll` is actually built up from multiple smaller "module" assemblies stored in the `UnityModulesPath`. +These modules contain types related to Audio, Animation, Particle Systems, Navigation, etc. +If you are writing a managed plugin that references assemblies from a UPM package as well as `UnityEngine.dll`, +then you may get confusing compiler errors from APIs in the package that use types defined in a module. +For example, if you reference the Unity UI Package from Unity 2019.2+, and use it to access `ScrollRect.velocity` (which returns a `Vector2`), +you would see an error like: + +> Error CS0012 The type 'Vector2' is defined in an assembly that is not referenced. You must add a reference to assembly 'UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. + +This error is shown because Unity UI's assembly doesn't reference the `Vector2` type from `UnityEngine.dll`; it uses the type from the _module assembly_ `UnityEngine.CoreModule`. +Therefore, the reference to `UnityEngine.dll` does not satisfy the compiler. +However, if you reference both `UnityEngine.dll` _and_ the module assembly, then you'll get compiler errors about duplicate type definitions! + +The solution is to remove the reference to `UnityEngine.dll` (using MSBuild's Item `Remove` syntax) and instead reference each module that you need individually. +Note that, for versions 2.2.0+ of this NuGet, Unity's module assemblies are referenced by default (rather than the "monolithic" `UnityEngine.dll`), +so you will likely never run into the aforementioned compiler errors. + +For the preceding example, your `.csproj` might look like the following. + +```xml + + + + + + + + +``` + +There are _no_ short-hand properties for assemblies stored in `$(UnityModulesPath)`; +the folder is completely flat, so you can just reference assemblies there by filename. +If you're unsure of which modules to reference, check out the Unity Scripting Manual. +Every type includes an "Implemented in" note at the top of the page, telling you in which of Unity's core modules the type is implemented. +For example, see the screenshot below of the manual page for `Vector2`: + +**Warning: There is a Unity module assembly named `UnityEngine.dll`. +This is not to be confused with the monolithic `UnityEngine.dll` assembly at `$(UnityEnginePath)`! +It contains types like `GUIElement`, `Network`, and `ProceduralMaterial`.** + +![Unity Scripting Manual page for Vector2, showing that the type is implemented in UnityEngine.CoreModule](../../images/unity-modules-docs.png) + +## Referencing assemblies in specific Unity versions + +Unity assembly paths sometimes change between versions: new assemblies are added, old ones are removed or broken up into UPM packages. +If your managed plugin must support multiple versions of Unity, then you may want to say +"reference this assembly, but only in these Unity versions" or "reference this assembly using the correct version-specific path". +For scenarios like these, this package provides MSBuild properties that expose the major, minor, and patch versions of your project's `UnityVersion`: + +1. `UnityVersionMajor`: e.g., `2021` in `2021.3.5f1` +2. `UnityVersionMinor`: e.g., `3` in `2021.3.5f1` +3. `UnityVersionPatch`: e.g., `5f1` in `2021.3.5f1` +4. `UnityVersionAsNumber`: equals `$(UnityVersionMajor).$(UnityVersionMinor)`, e.g., `2021.3` in `2021.3.5f1` + +These properties cannot be overriden, since they are parsed directly from the `UnityVersion` that you provide +(or from the `ProjectVersion.txt` file under the `UnityProjectPath` that you provide). + +The major, minor, and `UnityVersionAsNumber` properties are numeric, so you can use them in range inequalities in your project files. +For example, suppose you wanted to reference NUnit in an editor plugin that supports multiple versions of Unity. +The Unity Test Framework has included NUnit since version 2019.2, but for older versions of Unity, you would have to import NUnit yourself. +Therefore, to reference NUnit in _any_ Unity version, you could use [MSBuild Conditions](https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-conditions) like the following in your project file: + +**Warning: "less than" (`<`) inequalities must be escaped with `<`, since MSBuild project files are still XML files.** + +```xml + + + + + +``` + +The second `Reference` will overwrite the first for projects referencing Unity 2019.2+ assemblies. + +For assembly paths that change between Unity versions (e.g., `UnityEngineUIPath`), +the short-hand properties adjust according to the provided (or parsed) `UnityVersion`, using code much like above, +so you don't need to worry about conditionally setting the paths yourself. +If a path is not applicable in a particular Unity version (such as `NunitPath` in Unity 2019.1 and below), +then its MSBuild property will be undefined for that version (e.g., `$(NunitPath)` would be empty). + +## CI/CD Pipelines + +This package works with many different CI/CD (Continuous Integration/Continuous Deployment) setups. +Just remember that this package does not actually include any Unity assemblies; it only _references_ them at expected locations. +Therefore, whatever system is running .NET builds in your pipeline (be that a server, VM, container, etc.) +must separately install the desired version of the Unity engine or its assemblies. + +Here are some possible solutions: + +- **Use [Unity Build Automation](https://unity.com/solutions/ci-cd) (formerly Unity Cloud Build).** + This is Unity's first-party build automation web service, + so it will always have the latest Unity versions, build features, and solid integration with other [Unity Gaming Services](https://unity.com/solutions/gaming-services). + Simply select your project's Unity version (or tell UBA to look up the version from a `ProjectVersion.txt`) + and then the build machine will have the associated Unity assemblies pre-installed. + You can run whatever additional build scripts you want and use this NuGet package. + You can still host your code from anywhere; UBA builds are triggered by a webhook. +- **Compile your C# code _outside_ of Unity (e.g., in Visual Studio).** + You can copy the generated DLLs/PDBs via an MSBuild post-build event so that + they're imported into Unity as [managed plugins](https://docs.unity3d.com/Manual/UsingDLL.html) and won't require compilation during the CI/CD build process. + It's recommended to version those generated files in the same repository as the C# code (e.g., with [Git LFS](https://git-lfs.com/)). + It might feel redundant to store code and built executables in the same repository, but this serves the same benefits as storing, e.g., + artists' PhotoShop project files and generated images in the same repository; + namely, experts can work on the "source" files, but other team members (and the CI/CD pipeline) can + just work with "built" files without random build errors/warnings from the source. + This approach also lets you use (most of) the latest C# language features since you're not tied to Unity's compiler version. +- **Run the [unityci/editor](https://hub.docker.com/r/unityci/editor) images from Docker Hub.** + This option is good if your CI/CD system supports containerized build agents. + New tags are regularly added for the latest Unity versions as part of the [GameCI](https://game.ci/) project. + This Unity3D NuGet package will work inside a container run from those images. +- **Use [Unity Build Server](https://unity.com/products/unity-build-server).** + This option is good if you already have on-premise build servers; this service helps scale/manage on-prem builds. +- **Copy the actual Unity assemblies to your build agent.** + It is strongly recommended to store the assemblies on shared network storage or in a private NuGet package feed + (e.g., [GitHub Packages](https://github.com/features/packages) or [Azure Artifacts](https://azure.microsoft.com/en-us/products/devops/artifacts)). + Doing so allows you to easily reference the assemblies and share them between projects to reduce the size of your repositories and build agents. diff --git a/nupkg/Unity3D.nuspec b/nupkg/Unity3D.nuspec index 945502d..fc07681 100644 --- a/nupkg/Unity3D.nuspec +++ b/nupkg/Unity3D.nuspec @@ -2,7 +2,7 @@ Unity3D - 2.1.3 + 3.0.0-rc1 Unity Unity Technologies icon.png @@ -11,7 +11,7 @@ https://github.com/Rabadash8820/UnityAssemblies Simple, forward-compatible references to ANY Unity assembly on ANY platform. See current and archived release notes at https://github.com/Rabadash8820/UnityAssemblies/blob/main/CHANGELOG.md - Copyright ©2019-2023 Daniel Vicarel + Copyright ©2019-2024 Daniel Vicarel Unity Unity3D UnityEngine UnityEditor diff --git a/nupkg/build/Unity3D.props b/nupkg/build/Unity3D.targets similarity index 86% rename from nupkg/build/Unity3D.props rename to nupkg/build/Unity3D.targets index 21a8101..333f07f 100644 --- a/nupkg/build/Unity3D.props +++ b/nupkg/build/Unity3D.targets @@ -1,137 +1,147 @@ - - - - - - - C:\Program Files - Editor\Data\Managed - Editor\Data\UnityExtensions\Unity - - - - - /Applications - Unity.app\Contents\Managed - Editor\Unity.app\Contents\UnityExtensions\Unity - - - - - $([System.Environment]::GetFolderPath('System.Environment+SpecialFolder.UserProfile')) - Editor\Data\Managed - Editor\Data\UnityExtensions\Unity - - - - - - - - - SET_VERSION_OR_PROJECT - 0 - 0 - 0 - 0.0 - - - - - - $([System.IO.File]::ReadAllText(`$(UnityProjectPath)\ProjectSettings\ProjectVersion.txt`)) - $([System.Text.RegularExpressions.Regex]::Replace(`$(UnityProjectVersionTxt)`, `\r\n|\r|\n|: `, `,`)) - $(UnityProjectVersionCsv.Split(`,`)[1].Trim()) - - - $(UnityVersion.Split(`.`)[0]) - $(UnityVersion.Split(`.`)[1]) - $(UnityVersion.Split(`.`)[2]) - $(UnityVersionMajor).$(UnityVersionMinor) - - - - - - - Unity\Hub\Editor - $(OSInstallRootPath)\$(UnityInstallRootDir) - - $(UnityInstallRootPath)\$(UnityVersion) - $(UnityVersionInstallPath)\$(UnityManagedDir) - $(UnityVersionInstallPath)\$(UnityExtensionsDir) - - UnityEngine - $(UnityManagedPath)\$(UnityModulesDir) - - Editor\Data\PlaybackEngines - $(UnityVersionInstallPath)\$(UnityPlaybackEnginesDir) - $(UnityPlaybackEnginesDir)\AndroidPlayer - $(UnityVersionInstallPath)\$(UnityAndroidPlayerDir) - $(UnityPlaybackEnginesDir)\iOSSupport - $(UnityVersionInstallPath)\$(UnityiOSSupportDir) - - Library\ScriptAssemblies - $(UnityProjectPath)\$(UnityScriptAssembliesDir) - - - Editor\Data\Resources\PackageManager\BuiltInPackages - $(UnityVersionInstallPath)\$(UnityBuiltInPackagesDir) - - - Library\PackageCache - $(UnityProjectPath)\$(UnityPackageCacheDir) - - - - - $(UnityManagedPath)\UnityEngine.dll - $(UnityManagedPath)\UnityEditor.dll - - - $(UnityExtensionsPath)\GUISystem\UnityEngine.UI.dll - $(UnityScriptAssembliesPath)\UnityEngine.UI.dll - - - $(UnityScriptAssembliesPath)\UnityEngine.TestRunner.dll - $(UnityExtensionsPath)\TestRunner\UnityEngine.TestRunner.dll - - - - - $(UnityAndroidPlayerPath)\UnityEditor.Android.Extensions.dll - $(UnityiOSSupportPath)\UnityEditor.iOS.Extensions.Common.dll - $(UnityiOSSupportPath)\UnityEditor.iOS.Extensions.Xcode.dll - - - com.unity.nuget.newtonsoft-json%40*\Runtime\Newtonsoft.Json.dll - $(UnityPackageCachePath)\$(NewtonsoftJsonAssembly) - $(UnityManagedPath)\Newtonsoft.Json.dll - - - - com.unity.ext.nunit%40*\net*\unity-custom\nunit.framework.dll - $(UnityPackageCachePath)\$(NunitAssembly) - - - nuget.moq%40*\Moq.dll - $(UnityPackageCachePath)\$(MoqAssembly) - - - com.unity.analytics%40*\AnalyticsStandardEvents\Unity.Analytics.StandardEvents.dll - $(UnityPackageCachePath)\$(UnityAnalyticsStandardEventsAssembly) - - - - - - - - + + + + + + + C:\Program Files + Editor\Data\Managed + Editor\Data\UnityExtensions\Unity + + + + + /Applications + Unity.app\Contents\Managed + Editor\Unity.app\Contents\UnityExtensions\Unity + + + + + $([System.Environment]::GetFolderPath('System.Environment+SpecialFolder.UserProfile')) + Editor\Data\Managed + Editor\Data\UnityExtensions\Unity + + + + + + + + + SET_VERSION_OR_PROJECT + 0 + 0 + 0 + 0.0 + + + + + + $([System.IO.File]::ReadAllText(`$(UnityProjectPath)\ProjectSettings\ProjectVersion.txt`)) + $([System.Text.RegularExpressions.Regex]::Replace(`$(UnityProjectVersionTxt)`, `\r\n|\r|\n|: `, `,`)) + $(UnityProjectVersionCsv.Split(`,`)[1].Trim()) + + + $(UnityVersion.Split(`.`)[0]) + $(UnityVersion.Split(`.`)[1]) + $(UnityVersion.Split(`.`)[2]) + $(UnityVersionMajor).$(UnityVersionMinor) + + + + + + + Unity\Hub\Editor + $(OSInstallRootPath)\$(UnityInstallRootDir) + + $(UnityInstallRootPath)\$(UnityVersion) + $(UnityVersionInstallPath)\$(UnityManagedDir) + $(UnityVersionInstallPath)\$(UnityExtensionsDir) + + UnityEngine + $(UnityManagedPath)\$(UnityModulesDir) + + Editor\Data\PlaybackEngines + $(UnityVersionInstallPath)\$(UnityPlaybackEnginesDir) + $(UnityPlaybackEnginesDir)\AndroidPlayer + $(UnityVersionInstallPath)\$(UnityAndroidPlayerDir) + $(UnityPlaybackEnginesDir)\iOSSupport + $(UnityVersionInstallPath)\$(UnityiOSSupportDir) + + Library\ScriptAssemblies + $(UnityProjectPath)\$(UnityScriptAssembliesDir) + + + Editor\Data\Resources\PackageManager\BuiltInPackages + $(UnityVersionInstallPath)\$(UnityBuiltInPackagesDir) + + + Library\PackageCache + $(UnityProjectPath)\$(UnityPackageCacheDir) + + + + + $(UnityManagedPath)\UnityEngine.dll + $(UnityManagedPath)\UnityEditor.dll + + + $(UnityExtensionsPath)\GUISystem\UnityEngine.UI.dll + $(UnityScriptAssembliesPath)\UnityEngine.UI.dll + + + $(UnityScriptAssembliesPath)\UnityEngine.TestRunner.dll + $(UnityExtensionsPath)\TestRunner\UnityEngine.TestRunner.dll + + + + + $(UnityAndroidPlayerPath)\UnityEditor.Android.Extensions.dll + $(UnityiOSSupportPath)\UnityEditor.iOS.Extensions.Common.dll + $(UnityiOSSupportPath)\UnityEditor.iOS.Extensions.Xcode.dll + + + com.unity.nuget.newtonsoft-json%40*\Runtime\Newtonsoft.Json.dll + $(UnityPackageCachePath)\$(NewtonsoftJsonAssembly) + $(UnityManagedPath)\Newtonsoft.Json.dll + + + + com.unity.ext.nunit%40*\net*\unity-custom\nunit.framework.dll + $(UnityPackageCachePath)\$(NunitAssembly) + + + nuget.moq%40*\Moq.dll + $(UnityPackageCachePath)\$(MoqAssembly) + + + + com.unity.analytics%40*\AnalyticsStandardEvents\Unity.Analytics.StandardEvents.dll + $(UnityPackageCachePath)\$(UnityAnalyticsStandardEventsAssembly) + + + + + True + + + + + + + + + diff --git a/nupkg/buildMultiTargeting/Unity3D.props b/nupkg/buildMultiTargeting/Unity3D.props deleted file mode 100644 index 3fdee1d..0000000 --- a/nupkg/buildMultiTargeting/Unity3D.props +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/nupkg/buildMultiTargeting/Unity3D.targets b/nupkg/buildMultiTargeting/Unity3D.targets new file mode 100644 index 0000000..337cdb3 --- /dev/null +++ b/nupkg/buildMultiTargeting/Unity3D.targets @@ -0,0 +1,3 @@ + + + diff --git a/nupkg/readme.txt b/nupkg/readme.txt index cb4343d..c4fed02 100644 --- a/nupkg/readme.txt +++ b/nupkg/readme.txt @@ -20,29 +20,17 @@ Thank you for installing the Unity3D NuGet package! -To use this package, define a Directory.Build.props file in the same folder as your .csproj file (or any of its parent folders), -and add code like the following: +To use this package, add lines like the following to your .csproj file (or any imported MSBuild project file). - - + - 2023.2.1f1 + 2023.2.20f1 $(MSBuildProjectDirectory)\relative\path\to\UnityProject - - -Then, make sure your .csproj file looks something like this: - - - - - netstandard2.1 - - + - For complete documentation, see the README on GitHub: https://github.com/Rabadash8820/UnityAssemblies/blob/master/README.md \ No newline at end of file diff --git a/publish.sh b/publish.sh index 16b3109..46c9104 100755 --- a/publish.sh +++ b/publish.sh @@ -11,7 +11,7 @@ verifyReleaseNotes() { read -p "Press [Enter] when you're done..." } -bumpNugetVersions() { +bumpNuGetVersions() { echo "" echo "Changing package version strings to '$packageVersion' in:" @@ -24,15 +24,10 @@ bumpNugetVersions() { errNum=$? if [ $errNum != 0 ]; then return $errNum; fi - mainReadmePath=$cwd/README.md - echo " Sample project file at top of '$mainReadmePath'..." - sed --expression="s|$findRegex.*|$replaceTxt|" --in-place "$mainReadmePath" - errNum=$? - if [ $errNum != 0 ]; then return $errNum; fi - findRegex="Changelog" replaceTxt="$findRegex (currently v$packageVersion)](https://img.shields.io/badge/changelog-v$packageVersion-blue.svg)](./CHANGELOG.md)" + mainReadmePath=$cwd/README.md echo " Changelog badge at top of '$mainReadmePath'..." sed --expression="s|$findRegex.*|$replaceTxt|" --in-place "$mainReadmePath" errNum=$? @@ -73,6 +68,12 @@ bumpUnityVersions() { errNum=$? if [ $errNum != 0 ]; then return $errNum; fi + usagePath=$cwd/docs/$docsFolder/usage.md + echo " Sample project file at top of '$usagePath'..." + sed --expression="s|$findRegex.*|$replaceTxt|" --in-place "$usagePath" + errNum=$? + if [ $errNum != 0 ]; then return $errNum; fi + echo "" echo "Update the Readme FAQ with which Unity versions this package has been tested." echo "" @@ -132,7 +133,7 @@ nugetSign() { nugetPush() { echo "" echo "Publishing NuGet package at '$nupkgPath' to $nugetSource..." - # "$nugetPath" push "$nupkgPath" -Source "$nugetSource" -ApiKey "$nugetSourceApiKey" + "$nugetPath" push "$nupkgPath" -Source "$nugetSource" -ApiKey "$nugetSourceApiKey" errNum=$? if [ $errNum != 0 ]; then return $errNum; fi @@ -171,6 +172,7 @@ main() { packageVersion= unityVersion=$DEFAULT_UNITY_VERSION copyrightStartYear=$DEFAULT_COPYRIGHT_START_YEAR + docsFolder= timestamper=$DEFAULT_TIMESTAMPER signPackage=1 signingCertPath= @@ -183,7 +185,7 @@ main() { # Parse CLI options args=$(getopt \ --name publish \ - --options 'hp:u:c:t:n:k:' \ + --options 'hp:u:c:d:t:n:k:' \ --long ' \ help, \ remind-release-notes, \ @@ -191,6 +193,7 @@ main() { package-version:, \ unity-version:, \ copyright-start-year:, \ + docs-folder:, \ timestamper:, \ signing-cert-path:, \ nuget-source:, \ @@ -235,6 +238,11 @@ main() { copyrightStartYear=$1 ;; + (-d|--docs-folder) + shift + docsFolder=$1 + ;; + (-t|--timestamper) shift timestamper=$1 @@ -290,6 +298,10 @@ main() { echo "Missing required new semantic version string for the NuGet package. Use the '-p | --package-version' option" showUsage=true; fi + if [ -z $docsFolder ]; then + echo "Missing required documentation folder name (under docs/). Use the '-d | --docs-folder' option" + showUsage=true; + fi if [ -z $nugetSourceApiKey ] && [ $pack == true ]; then echo "Missing required API key for NuGet source '$nugetSource'. Use the '-k | --nuget-source-apikey' option" showUsage=true; @@ -310,6 +322,8 @@ main() { echo " Optional. Latest Unity version to use in documentation. Default is '$DEFAULT_UNITY_VERSION'." echo " -c, --copyright-start-year " echo " Optional. Copyright start year to use in documentation. Default is '$DEFAULT_COPYRIGHT_START_YEAR'." + echo " -d, --docs-folder " + echo " Required. Name of folder (under docs/) where documentation Markdown files are stored." echo " -t, --timestamper " echo " Optional. URL of an RFC 3161 timestamp server for package signing. Default is '$DEFAULT_TIMESTAMPER'." echo " --[no-]sign-package" @@ -331,7 +345,7 @@ main() { # Make sure user has updated package info verifyReleaseNotes && \ - bumpNugetVersions && \ + bumpNuGetVersions && \ bumpUnityVersions && \ bumpCurrentYear diff --git a/test/Directory.Build.targets b/test/Directory.Build.targets new file mode 100644 index 0000000..68e64de --- /dev/null +++ b/test/Directory.Build.targets @@ -0,0 +1,3 @@ + + + diff --git a/test/TestAllRefs/TestAllRefs.csproj b/test/TestAllRefs/TestAllRefs.csproj index e67e916..1d7923c 100644 --- a/test/TestAllRefs/TestAllRefs.csproj +++ b/test/TestAllRefs/TestAllRefs.csproj @@ -1,15 +1,13 @@ - + - - $(DefineConstants);NEWTONSOFT_JSON_AVAILABLE $(DefineConstants);NUNIT_AVAILABLE $(DefineConstants);MOQ_AVAILABLE - $(DefineConstants);UNITY_ANALYTICS_STANDARD_EVENTS_AVAILABLE + $(DefineConstants);UNITY_ANALYTICS_STANDARD_EVENTS_AVAILABLE $(DefineConstants);UNITYENGINE_DEVICE_AVAILABLE diff --git a/test/TestMinimalExplicit/TestMinimalExplicit.csproj b/test/TestMinimalExplicit/TestMinimalExplicit.csproj index 71548f7..295a1c7 100644 --- a/test/TestMinimalExplicit/TestMinimalExplicit.csproj +++ b/test/TestMinimalExplicit/TestMinimalExplicit.csproj @@ -1,4 +1,3 @@ - + - diff --git a/test/TestMinimalFromProject/TestMinimalFromProject.csproj b/test/TestMinimalFromProject/TestMinimalFromProject.csproj index 6371ddf..6761cc5 100644 --- a/test/TestMinimalFromProject/TestMinimalFromProject.csproj +++ b/test/TestMinimalFromProject/TestMinimalFromProject.csproj @@ -1,4 +1,3 @@ - + - diff --git a/test/Unity3DTests.sln b/test/Unity3DTests.sln index 80950cd..84d8fa3 100644 --- a/test/Unity3DTests.sln +++ b/test/Unity3DTests.sln @@ -13,12 +13,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "nupkg", "nupkg", "{CE043F66 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{E4D0EF7B-F491-4BD5-BDD3-ABD92D3BEE05}" ProjectSection(SolutionItems) = preProject - ..\nupkg\build\Unity3D.props = ..\nupkg\build\Unity3D.props + ..\nupkg\build\Unity3D.targets = ..\nupkg\build\Unity3D.targets EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "buildMultiTargeting", "buildMultiTargeting", "{98FA5AC9-B938-4AA6-B8B1-1B6468878191}" ProjectSection(SolutionItems) = preProject - ..\nupkg\buildMultiTargeting\Unity3D.props = ..\nupkg\buildMultiTargeting\Unity3D.props + ..\nupkg\buildMultiTargeting\Unity3D.targets = ..\nupkg\buildMultiTargeting\Unity3D.targets EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestMinimalFromProject", "TestMinimalFromProject\TestMinimalFromProject.csproj", "{7C22AA1F-E1E9-4592-BBB5-06E2DF7E74D4}" @@ -37,12 +37,22 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E365C332-897A-43CA-8702-F9475896349B}" ProjectSection(SolutionItems) = preProject Directory.Build.props = Directory.Build.props + Directory.Build.targets = Directory.Build.targets UnityAssetsPath.props = UnityAssetsPath.props UnityVersion.props = UnityVersion.props EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestMinimalExplicit", "TestMinimalExplicit\TestMinimalExplicit.csproj", "{4EFD5237-59D1-431D-A60A-A8B1D397AC1B}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{565DD552-C304-431C-802A-95E92E81A6E8}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "v3", "v3", "{2855D997-7DAC-4A81-B2AA-BCD46CF22290}" + ProjectSection(SolutionItems) = preProject + ..\docs\v3\faq.md = ..\docs\v3\faq.md + ..\docs\v3\short-hand-properties.md = ..\docs\v3\short-hand-properties.md + ..\docs\v3\usage.md = ..\docs\v3\usage.md + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Net472_2021_3|Any CPU = Net472_2021_3|Any CPU @@ -140,6 +150,8 @@ Global {E4D0EF7B-F491-4BD5-BDD3-ABD92D3BEE05} = {CE043F66-AFE3-43C6-8D52-E3059B8B2CDB} {98FA5AC9-B938-4AA6-B8B1-1B6468878191} = {CE043F66-AFE3-43C6-8D52-E3059B8B2CDB} {E365C332-897A-43CA-8702-F9475896349B} = {157D3502-954C-4200-81B5-4A381B9F4C80} + {565DD552-C304-431C-802A-95E92E81A6E8} = {157D3502-954C-4200-81B5-4A381B9F4C80} + {2855D997-7DAC-4A81-B2AA-BCD46CF22290} = {565DD552-C304-431C-802A-95E92E81A6E8} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {AFEDC263-39BC-42D3-960F-FD230F8257F7}