#if UNITY_WEBPLAYER been removed?

Hi. I’ve googled the topic and checked Answers but this hasn’t been addressed in Unity 5 as far as I can see.

I’m using code:


As you can see, the WEBPLAYER if isn’t behaving. According to documentation this should be a valid line of code, but it didn’t auto-prompt at all and the actual command (Application.LoadLevel(0)) appears as if commented out.

Has the functionality been removed because Unity is moving away from the Web Player? How else could I get the web player to do (x) if this function is called when playing via my website?


Well, you probably had set the targetplatform to Standalone initially. When you change the targetplatform to Webplayer you have to sync the MonoDevelop project, otherwise the new settings won’t apply.

and the actual command (Application.LoadLevel(0)) appears as if commented out.

Of course it appears like that since this is a preprocessor command. The code is literally commented out because the symbol “UNITY_WEBPLAYER” is not defined when you have not compiled your code for webplayer. Likewise when UNITY_WEBPLAYER is defined, other symbols like UNITY_STANDALONE or UNITY_ANDROID, … are not defined and therefore the code in those sections is commented out. It won’t actually exist in a build version.

As i said preprocessor symbols affect only the behaviour of the compiler. If you change the platform in Unity you should sync the MonoDevelop project to update the settings and cause a recompile of your project.