- Home /
How do I get different spawn areas in one terrain?
I need a little bit of a starting help...
I want to put a door on my terrain when the character opens it , it leads him inside a village then when he goes back it will put him outside the door and not at the starting place where the character first was.
It is a little complicated but I hope you understand.
Thanks alot :)
Answer by greatestprez · Dec 17, 2012 at 08:04 PM
Maybe fill an array with empty game objects, then choose a random game object out of the array, then set your players position to the random game objects position. Example(note that code has not been tested):
public Transform[] points;
void pickRandomSpawnPos() {
transform.position = points[Random.Range(0, points.Length)].position;
}
Great reply. Unforunately back then I could not code a Debug.Log :)
Once again. $$anonymous$$any thanks.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
A node in a childnode? 1 Answer
Android with Mac unity remote 4 Answers
Simple Maya/Unity question. How do I flip a cube inside out to make a room? 1 Answer
Terrain isn`t working PLEASE help 2 Answers