Skip to content

Commit 883f4d7

Browse files
committed
Add platform-dependent compilation section to CodingGuidelines
1 parent 5f397e5 commit 883f4d7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

CodingGuidelines.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,3 +582,19 @@ public class MyClass
582582
```
583583

584584
>Alternatively, use Unity's "SharedMaterial" property which does not create a new material each time it is referenced.
585+
586+
## Use [platform dependent compilation](https://docs.unity3d.com/Manual/PlatformDependentCompilation.html) to ensure the Toolkit won't break the build on another platform
587+
588+
* Use `WINDOWS_UWP` in order to use UWP-specific, non-Unity APIs. This will prevent them from trying to run in the Editor or on unsupported platforms. This is equivalent to `UNITY_WSA && !UNITY_EDITOR` and should be used in favor of.
589+
* Use `UNITY_WSA` to use UWP-specific Unity APIs, such as the `UnityEngine.XR.WSA` namespace. This will run in the Editor when the platform is set to UWP, as well as in built UWP apps.
590+
591+
This chart can help you decide which `#if` to use, depending on your use cases and the build settings you expect.
592+
593+
| | UWP IL2CPP | UWP .NET | Editor |
594+
| --- | --- | --- | --- |
595+
| `UNITY_EDITOR` | False | False | True |
596+
| `UNITY_WSA` | True | True | True |
597+
| `WINDOWS_UWP` | True | True | False |
598+
| `UNITY_WSA && !UNITY_EDITOR` | True | True | False |
599+
| `ENABLE_WINMD_SUPPORT` | True | True | False |
600+
| `NETFX_CORE` | False | True | False |

0 commit comments

Comments
 (0)