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

[Unity 4.6.9p4] Error building player because script class layout is incompatible between the editor and the player. #21

Open
LoganBooker opened this issue Oct 18, 2016 · 1 comment

Comments

@LoganBooker
Copy link

Hello veblush, thanks for your hard work with the incremental compiler. Has probably saved me hours already in wait times!

I wanted to bring to your attention a possible issue with the compiler: it doesn't seem to play nice when creating standalone builds. In my case a typical 32-bit Windows one, but this could be an issue for all platforms.

So you know, we're still running 4.6.9p4. Upgrading to 5.x is not an option -- we have a large tech base on this version, including a significant rewrite of Unity 4's rendering pipeline. It's possible this issue doesn't appear in 5.x, but I haven't tested as such.

Basically, all you have to do is try and create a standalone build. After a second or two you'll see this error:

Error building player because script class layout is incompatible between the editor and the player.

Restarting Unity, rebuilding the library, recompiling again, etc. has no effect. The error continues to appear.

A workaround is possible via the following steps:

  1. Go to Assets -> Open C# Compiler Settings...
  2. Change "Compiler" from "Incremental 6" to "Mono 6".
  3. Attempt to build the project, which will fail with the following error:

Internal compiler error. See the console log for more information. output was:Compiler redirection error: System.NullReferenceException
Object reference not set to an instance of an object at Program.Compile (System.String[] args, .Logger logger, .Settings settings) [0x00000] in :0
at Program.Main (System.String[] args) [0x00000] in :0

  1. After the build fails, go back to the compiler settings and change it back to "Incremental 6".
  2. Build the project again. This time it will succeed.

I'm not entirely sure why this works, but my theory is switching the compiler clears out the old data being held by the compile server. However, killing / restarting the server doesn't have the same effect as the switch does, so I'm not sure if this is the case.

Please let me know if you need more information.

@veblush
Copy link
Contributor

veblush commented Oct 31, 2016

Oh I totally understand why you stick to use Unity 4.x 😉.

Actually IncrementalCompiler was being developed to make editor-build fast. It was thought dangerous to support build final executable with this compiler because there are many uncertainties in addressing differences between old Mono and new Roslyn compiler.

There might be a workaround for handling this problem. I'll take a look at this. Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants