Ensuring a script is the first thing to execute

Is there a way to ensure that a single script in a scene runs before anything else is created? I have a scene that requires the user to be logged in and right now, I just have a script that in the Start() method checks if they are logged in and if not, I load the Login level. I’m finding a race condition where some objects in that scene are being created before the login check runs. I would like to have something in each scene that I can make sure will always be the first thing to run to verify they are logged in. Is there a way to do this? Or is there a better way to accomplish what I’m trying to do?

well just have any script after the check just have an if statement, like it will only create things if(user.loggedin) or something like that

I’m not sure that’s what you’re looking for, but I hope you solve your problem. Good Luck

I would make a login scene.

If theres nothing else too load, your script wins :wink:

I already have a login scene. Problem is (and maybe this is only a Editor issue) when you start the game in the second scene (that requires login). The second scene checks if they are logged in and kicks them back to login.

Also, FlyingAce, that is what my script does. Problem is, how do you know that script will execute before another script?

Try using Script Execution Order settings for your project.

Oh cool, that might work cdevl!