I have a script that should spawn my falling platforms back into their places if the player dies. This works fine in the editor (and in Unity Remote 5) but after compiling it doesn’t work anymore. First I used foreach loops but it didn’t work. When I read that there are problems with them I changed my script to use normal for loops but the problem still exists after build.
Here are the parts of the code that don’t execute after build:
void Start () {
platforms = GameObject.FindGameObjectsWithTag ("fallingGround");
fallingPositions = new Vector2[platforms.Length];
for (int i = 0; i < platforms.Length; i++) {
fallingPositions _= platforms*.transform.position;*_
_ Debug.Log(fallingPositions*);
}
}
public void playerDied () {
player.transform.position = spawnPoint.transform.position;
lifeCount–;
for (int i = 0; i < platforms.Length; i++) {
GameObject platform = platforms;
platform.transform.position = fallingPositions ;
platform.GetComponent ().mass = 10000;
platform.GetComponent ().gravityScale = 0;
platform.GetComponent ().playerEntered = false;
}
}*_