Hi,
If this is plainly stupid please forgive me as I’m very new to Unity… I tried to search for this from forum but nothing quite the same there. Using 5.6.0f3 version.
So, I followed the Tutorial Roll a Ball, and all goes fine until I try to build for Windows standalone. I suddenly get all kinds of errors hinting I’m missing assembly references… I even copied all the scripts as-is from the tutorial pages to see if I had some mistakes in code. But no, the same… Then I tried to use MonoDevelop instead of VS 2017 but the same. What is interesting that if I after these fail messages select WebGL and build again I get no errors and it’s all fine… What’s wrong? Some module installations missing?
The type of messages I get are:
- Assets/PlayerController.cs(5,33): error CS0246: The type or namespace name `MonoBehaviour’ could not be found. Are you missing an assembly reference?
- Assets/Scripts/CameraController.cs(4,33): error CS0246: The type or namespace name `MonoBehaviour’ could not be found. Are you missing an assembly reference?
- Assets/Scripts/Rotator.cs(4,24): error CS0246: The type or namespace name `MonoBehaviour’ could not be found. Are you missing an assembly reference?
- Assets/PlayerController.cs(8,9): error CS0012: The type
UnityEngine.MonoBehaviour' is defined in an assembly that is not referenced. Consider adding a reference to assembly UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’
And so on… Any ideas what is this? I could imagine getting these errors if I missed “using” statements from files but as said they are now direct copies from tutorial pages.
This sentence makes me suspicious. How, exactly, are you attempting to build the standalone? MonoDevelop or VS aren’t even involved in that process; they’re basically (really nice) text editors.
Hi StarManta, I build by selecting File | Build Settings | Build when the PC, Mac and Linux standalone has been selected in Platform part of the window.
I know what those editors are but I thought that if I was missing some modules maybe MonoDevelop could tell me whereas VS 2017 said nothing but build still failed. That was maybe a long shot but tried it anyway, without luck.
OK, the kinds of errors you’re seeing are what I would expect if someone tried to build from VS or something. But yeah, the configuration of VS/MD doesn’t have any impact on Unity’s compilation process.
If you’re not doing that, then this has become a more odd question, possibly a Unity bug.
I would try switching platforms and switching back; restarting Unity; maybe even reinstalling Unity if nothing else works. I could imagine some of the libraries maybe not getting correctly installed causing this error.
Sorry I guess my comment about editors was pretty misleading! But I actually re-installed Unity again, and re-started it etc… Still the same.
I would assume that if there’s a fundamental problem with my scripts (which are now direct copies from tutorial) the build would fail for any platform. But no, Win it is 
Yeah, as long as your scripts include “using UnityEngine;” (as I assume the ones from the tutorial do) then this is not related to the content of the scripts.
If you’ve tried reinstalling, then it might be time to file a bug report with Unity (Help → Report Bug) - this is weird. Especially if WebGL compiles but not a desktop standalone, that’s super weird. Just about every non-bug explanation I can think of would affect all platforms.
Yes all the scripts do include that on the first line. As I’m that new with this stuff I’m afraid it’s me messing with something anyway… but maybe I just file the report and we’ll see! Thanks, StarManta!
It sounds like it’s unable to find UnityEngine.dll when building. It should be there when you install Unity though, so if you tried reinstalling and it still can’t find it, something weird must be going on. It should be in:
C:\Program Files\Unity\Editor\Data\PlaybackEngines\windowsstandalonesupport\Managed\UnityEngine.dll
If it’s not there, maybe you didn’t fully install Unity? Did you check “Windows Standalone” in the installer when you were installing? You need that if you want to build for Windows.
Thanks for the comment, makeshiftwings. I checked and that UnityEngile.dll is in the folder you pointed out. When I re-installed the editor I actually checked all the tickboxes there were available. But chances are I’ve done something wrong still, because my experience with this tool is less than limited so to say.
I filed a bug report as I couldn’t figure out anything else and also posted the question to the official thread of that Tutorial - which I found after submitting the bug report, of course…
I’m fairly certain this isn’t going to be related to that tutorial project. Can you try creating a new blank project, create a single script file, and attempt to build it? (Just the default created C# file will be fine)
Well thought, StarManta.
Tried this: empty project, added single 3D GameObject and attached default script to that => Win build fails, WebGL ok…
I will try to install older version of Unity and see if I can get around the problem. Maybe I’ve played too many video games and my PC is punishing me?
Yeah, if it fails on a near-empty project, definitely a Unity bug. Hopefully an older version works for you until UT is able to fix the issue.
Unity 5.5.3f1 and building for Win works as I opened the tutorial! Exe also runs fine.
Background color was lost and there are few warnings about “Ignoring asset refresh…” but that’s got to do with the fact the scene was created with newer version originally - I suppose.
I noticed that this version has Target Platform and Architecture dropdown menus in build window and 5.6.0f3 didn’t have any of those. Should it have? This current version also asks for filename for .exe whereas previous didn’t, it just failed.
Smooth start 