- Home /
Scenes not loading on web player
Hi. I made a little script that loads a level whenever cetain tags are not present
function Update () { if ((GameObject.FindWithTag ("1") == "null") & (GameObject.FindWithTag ("2") == "null"))
Application.LoadLevel ("youWin");
if ((GameObject.FindWithTag ("3") == "null") & (GameObject.FindWithTag ("4") == "null") & (GameObject.FindWithTag ("Lobo3") == "5") & (GameObject.FindWithTag ("6") == "null"))
Application.LoadLevel ("youLose");
}
Now, it runs fine inside of Unity, but when I build it for web the levels won't load when the conditions are met. What's wrong?
Answer by Luis 2 · Nov 26, 2010 at 02:10 AM
Solved! I changed all instances of this:
(GameObject.FindWithTag ("1") == "null")
to this:
!GameObject.FindWithTag ("1")
figuring it's supposed to yield the same result but in a cleaner way, and it worked!
GameObject.FindWithTag doesn't return a string. Take the parentheses off of "null". No idea why this would have worked for you in the Editor; there's no way it can function properly, anywhere. 'GameObject.FindWithTag ("Lobo3") == "5"' also makes no sense whatsoever.
Answer by Maarten · Nov 25, 2010 at 06:24 PM
Are you sure you are exporting the levels to in the webplayer?
All three levels are in the "Scenes In Build" area in the Build $$anonymous$$anager. Also, the win/lose levels have a simple "mouse click/load level" script which do load the main level in the webplayer (I tried it by placing them higher on the build list)
Your answer