- Rocko Bonaparte
- Posts: 39
- Joined:
Properly excluding editor from Unity build
I tried to do a test build of my project and slammed into a bunch of editor-only Noesis code that got dragged into the build. This is a lot of stuff in Assets\NoesisGUI\Plugins\Editor. For example of just one in one file:
Assets\NoesisGUI\Plugins\Editor\NoesisMenu.cs(7,18): error CS0234: The type or namespace name 'MenuItemAttribute' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)
It's an editor-only thing and doesn't have a preprocessor definition around it. Nonetheless, I assume it should be excluded. Is there an assembly definition or something I should be hunting down?
Assets\NoesisGUI\Plugins\Editor\NoesisMenu.cs(7,18): error CS0234: The type or namespace name 'MenuItemAttribute' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)
It's an editor-only thing and doesn't have a preprocessor definition around it. Nonetheless, I assume it should be excluded. Is there an assembly definition or something I should be hunting down?
Re: Properly excluding editor from Unity build
Everything inside Editor folders is considered by Unity as editor-only by default. We have plans (#1827) to deprecate the .unitypackage and move to the new Package Manager + assembly definition.
- Rocko Bonaparte
- Posts: 39
- Joined:
Re: Properly excluding editor from Unity build
I am assuming I have some inconsistency in project structure or settings then, but I wouldn't know what. If I am building code in Visual Studio then I am okay. Within the editor and play mode, I am okay. However, when I try to build a game executable (for Windows), then Unity wants to treat those files as if they should be built too.
It looks like it only does this with Noesis. I have a few other assets that it doesn't complain about. I would note Odin Inspector because that is all editor-side for me. I think they are using the newer paradigm so that's probably irrelevant though.
All I can really think is that I have a using directive that drags in this editor-side stuff somewhere, but I couldn't readily tell where. I am guessing it is an uncommon problem so I will dig some more. I rarely do full game builds so I am poorly-versed in all the ways that uniquely goes wrong.
It looks like it only does this with Noesis. I have a few other assets that it doesn't complain about. I would note Odin Inspector because that is all editor-side for me. I think they are using the newer paradigm so that's probably irrelevant though.
All I can really think is that I have a using directive that drags in this editor-side stuff somewhere, but I couldn't readily tell where. I am guessing it is an uncommon problem so I will dig some more. I rarely do full game builds so I am poorly-versed in all the ways that uniquely goes wrong.
Re: Properly excluding editor from Unity build
Probably adding assembly definitions will solve your problem. A few clients are already doing that till it happens officially.
- Rocko Bonaparte
- Posts: 39
- Joined:
Re: Properly excluding editor from Unity build
For reference for others in the future, it means adding an assembly definition for the Assets/NoesisGUI/Plugins/Editor folder. It needs to depend on the parent NoesisGUI assembly definition (I think it came with it or else I created one at some point?). The editor one needs to include only for the Editor platform.
Who is online
Users browsing this forum: Bing [Bot] and 58 guests