Hi!!! I want my player start on different locations everytime I start a new game? How do I do that? Just now my player is in the game at the same startplace! Thanks for help!!!!
asked Oct 18 '10 at 11:37 PM
One simple solution is to:
1) create several empty GameObjects, tag or name them as "spawnpoint" or something.
2) cache the transform of these GOs at the start of your game (via list, array, hashtable, etc)
3) randomly search through your array of spawnpoint transforms and use the resulting transform.position as your player's transform.position.
All that within your Awake().
Simple Hint: You could create a SpawnPoint manager script for your player, attach that to a SpawnPointManager GameObject, and do all those simple steps there instead. That way, you'd be separating the spawning logic of your character from any other stuff you'd be doing.
answered Oct 19 '10 at 02:35 AM
I tried Bravinis idea but it does not work, somting is wrong with the code! It says at the second last line 14 - expcting ), found ;.
Thankyou for awnser! Hope you will get back! or sombody know whats wrong? Thankyou!!!!!
answered Oct 19 '10 at 08:01 AM
create a script with the code below and attach it to an object on the scene then delete your Player object. drag your Playerpreab on the inspector to the var PlayerPrefab.
sorry for the bad indentation, still new to this.
answered Oct 19 '10 at 02:28 AM