Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error: type or namespace name 'Localization' does not exist in the namespace 'UnityEditor' #494

Open
jamesplease opened this issue Aug 30, 2021 · 3 comments
Labels
bug (critical) This needs to be fixed as soon as possible

Comments

@jamesplease
Copy link
Contributor

jamesplease commented Aug 30, 2021

Hi! I've been following the Wiki to better understand this project, but I was unable to successfully complete the instructions on building the project.

When I attempt to build from the main branch I receive this error:

Assets\Scripts\Dialogues\DialogueDataSO.cs(6,19): error CS0234: The type or namespace name 'Localization' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)

Here's a screenshot showing the error:

image

This is very similar to the error that a user reported in #403, but it's not clear to me if the solution presented there applies to my situation as I haven't made any code changes.

Steps I followed

  1. I cloned the repository
  2. Making no code changes, I followed the instructions from the build wiki:
  3. The first step was packaging the game's asset bundles, which I was able to complete without any build errors
  4. I then tried to run "Build" from the "Build Settings" panel. The folder I tried to build to was ./Build (a new folder within the root directory of the repo)

Here's a git status showing the files that have been changed since my clone. I believe these changes are due to packaging the asset bundle.

image

As a quick check, I reverted all of these changes (via git checkout -- .) and tried to run a build with a completely clean install. The same error occurred.

Does anyone have any tips or advice on what might be causing this problem? Thank you so much for taking the time to read this issue!

Operating System:
Tested on both:

  • Windows 10 Home 20H2 19042.1165
  • macOS Big Sur 11.5.2

Unity version: 2020.3.12f1

@jamesplease jamesplease changed the title Build error: Build error: type or namespace 'Localization' does not exist in the namespace 'UnityEditor' Aug 30, 2021
@jamesplease jamesplease changed the title Build error: type or namespace 'Localization' does not exist in the namespace 'UnityEditor' Build error: type or namespace name 'Localization' does not exist in the namespace 'UnityEditor' Aug 30, 2021
@ciro-unity
Copy link
Contributor

Thanks @jamesplease. The issue is exactly what the debug panel reports: there are classes that are part of the UnityEditor namespace which are being included in the code that has to go into the build. This makes it fail, since builds cannot contain any editor-related code.
This is a mistake on our end, should be easy to fix by just wrapping those classes in a conditional compilation, to say the compiler not to include them when outside of the editor (i.e. in the build). I'll fix it as soon as I can push.

@ciro-unity ciro-unity added the bug (critical) This needs to be fixed as soon as possible label Sep 5, 2021
@kamilswiec
Copy link

kamilswiec commented Oct 20, 2021

I've run into similar issue when I tried to use reuse StateMachine code in my project.

For some reason Editor folders were included in build but as far as I understand the docs they should not as they are treated as special folders. Wrapping around conditional compilation fixed issue in my project but wanted to make sure if that was the case so tried building this open-project.

I followed instructions in wiki and I was able build game without adding conditional compilation to editor scripts.
The only difference I spotted was that in RiderIDE folder named editor from open-project had different icon? In my project editor folders copied from open-project did not change the icon in RiderIDE. Not sure if this issue is not being caused by some settings in Unity? Because for some reason Editor folders are included in my projects builds after copying from here.

I've used same version in my project as open-project is using now - 2020.3 with latest patch.

@yaungsuzeng123
Copy link

LOL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug (critical) This needs to be fixed as soon as possible
Projects
None yet
Development

No branches or pull requests

4 participants