i have tried a few ways of setting the position of the player after application.load level but i cant seem to get it to work, any ideas on how to solve this?
thanks
i have tried a few ways of setting the position of the player after application.load level but i cant seem to get it to work, any ideas on how to solve this?
thanks
Simply …
are you familiar with using the Awake() and Start() functions in Unity??
Try this. Have a marker object in your scene – I mean, very simply, an empty game object.
In other words, just click on “Game Object” menu then “Create empty…”.
Name this new “marker” object to be “MyHappyStartPosition”
Now, make a new script attached to your player car, dragon, warlord or whatever she is.
In the script, just say this:
var myStartPosition:Vector3;
myStartPosition =
GameObject.Find("MyHappyStartPosition").transform.position;
transform.position = myStartPosition;
that’s it. You can do that in the Start() function.
Now when you are using the editor, just MOVE AROUND the marker object, MyHappyStartPosition, however you want.
Click Play, and you’ll see the dragon/warlord/whatever begins the game in that position.
It’s important to use “marker objects” all the time in Unity development.
Hope it helps!
Just BTW. if you simply sit the character, where you want it, it will be there in that position when the game Plays! But I assume you are building it or something, and hence, need to do what I describe here for your greatest convenience.