Hi. This sentence is unrelated but I wrote this twice now because I forgot to log in, so I’m gonna try to keep this short and to the point.
I’m making a block stacking game where you press a button or key to release an object and if it lands on a target platform, it spawns another of the same object, and if it doesn’t then the game restarts. If you land the second object on top of the first object, it still spawns a new one. This is all fine (coding might be total ass but it works at least).
The problem (at least this is what I think) is that both touching the objects and the platform spawns a new one, so if you touch both it spawns more than one, and if those land and touch them again, they just multiply until Unity explodes of fear.
I’ve included the code for the spawner (though it may not be enough. Also I know that there are a few problems in my code but for now everything except the part I mentioned works). I am a total newbie to all of this so if anything is unclear or stupid then sorry about that. I hope someone can solve this though. Thanks a lot!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Spawner : MonoBehaviour
{
public GameObject[] Ladder;
public void Start()
{
SpawnNewLadder();
}
public void SpawnNewLadder()
{
int i = Random.Range(0, 0);
Instantiate(Ladder*, transform.position, Quaternion.identity);*
- }*
}