Skip to main content
Search our knowledge base

Excluding Scripts and Assets from builds

Comments

4 comments

  • amnah rababaa

    i have purchased  VReasy asset ,,,when i importing it to unity its tool menu is not appeared in the upper bar ,,how can i fix that ??

    -5
  • Camillo

    Good point!

    1
  • Hugo Zink

    There is already an official way to do this, and it's by putting the scripts and resources in any folder called "Editor". If you make a tool that is only ever used in the editor, you oughta put all of its assets inside a folder called "Editor" and it will not be included in the build at all. Symlinks are overkill and #if statements are ugly.

    -2
  • Andres Leone

    While it's noted that you can surround your editor-only code inside #if UNITY_EDITOR blocks, Unity will still throw errors in builds like "A scripted object [...] has a different serialization layout when loading. Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?" or even crash.

    This means Unity is unable to strip the editor-only serialized data from builds, and so the solution only works in some specific cases.

    There's no [SerializeFieldEditorOnly] equivalent, if that's what you need, you may want to look at the EditorOnly tag and the HideFlags.DontSaveInBuild (this flags don't apply to individual scripts on prefabs, idk about scenes).

    0

Please sign in to leave a comment.