I just want ONE object to be created at a spot but it just creates them endlessly, even made unity crash. :D
using UnityEngine;
using System.Collections;
public class Spawning : MonoBehaviour {
public GameObject target;
Vector3 spawnSpot;
bool once = false;
void Start() {
if(once = !once) {
spawnSpot = target.transform.position;
Instantiate(transform, spawnSpot, Quaternion.identity);
once = true;
}
}
}
Thanks in advance.
↧