Excluding Editor Code

In your Creator Toolkit C# assembly, you may have code in multiple Editor subdirectories. To prevent compiler issues and analyzer warnings, you need to exclude this code.

Valid Methods

1. Create Assembly Definition inside each Editor folder (Preferred)

The first and preferred option is to create an Assembly Definition file inside each Editor folder. Make sure that the only selected platform is Editor.

Exclude editor code, make sure the only selected platform is editor

2. Surround Editor code with Directive

The second option is to surround all Editor code in a #if UNITY_EDITOR ... #endif directive. You will need to do this for every file that haas Editor code.

Compiler Errors about UnityEditor Symbols not found

If you're seeing compiler errors about UnityEditor symbols not being found, check the list of platforms in the Assembly Definition you created for Editor code. Make sure the only platform is Editor (see screenshot above).