Hey everyone, first of all i am a complete Unity noob so please excuse any dumb questions:
I am trying to make a 3D Jump 'n Run in Unity in which you have to complete a random Stage playing as a Ball. The Stage consists of 3 lanes, each 10 Units apart, to which the Ball can Jump to.
Right now i am trying to make the randomizer which creates the Stage (The “Stage” consists of random Platforms scattered across the 3 lanes).
#pragma strict
var zPos = 7.5;
var xPos = 0;
var xHelp;
var ReMax = 15;
var Re = 0;
var Ground : GameObject;
function Start () {
Ground = GameObject.Find("Ground");
while (Re< ReMax){
if (xPos == 0){
xHelp= Random.Range(1,4);
Debug.Log (Random.Range);
if (xHelp== 1){
xPos = -10;
transform.Translate(xPos,0,0);
Instantiate(Ground);
transform.Translate(-xPos,0,0);
Re += Re;
transform.Translate(0,0,zPos);
}
if (xHelp== 2){
xPos = 10;
transform.Translate(xPos,0,0);
Instantiate(Ground);
transform.Translate(-xPos,0,0);
Re+= Re;
transform.Translate(0,0,zPos);
}
if (xHelp== 3){
xPos = 0;
transform.Translate(xPos,0,0);
Instantiate(Ground);
transform.Translate(-xPos,0,0);
Re += Re;
transform.Translate(0,0,zPos);
}
}
}
}
Unity itself doesnt give me an Errormessage when i try to run the Script but the program just frezzes as soon as i hit play. The Gameobject “Ground” are the Platforms the program is supposed to create. I have never worked with Instantiate so i kinda suspect my error to be the spawning of the Platforms.
I’ve been stuck here for a while and dont realy know how to go on, so if someone would have a suggestion, i’d be very grateful.