Quantcast
Channel: Answers by "dubbreak"
Viewing all articles
Browse latest Browse all 68

Answer by dubbreak

$
0
0
As roberbu pointed out you're creating copy of the object you have that script on. But then that object creates a copy of itself and so on and so on. First question is: what are you trying to do? I.e. what's your goal. There may be a better way. As for fixing your script, I tested the following as working (creates one copy of object at the location of "target"): using UnityEngine; using System.Collections; public class Spawning : MonoBehaviour { public GameObject target; Vector3 spawnSpot; static bool makeCopy = true; void Start() { if(makeCopy) { makeCopy = false; spawnSpot = target.transform.position; Instantiate(transform, spawnSpot, Quaternion.identity); } } }

Viewing all articles
Browse latest Browse all 68

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>