So, I’m running a simple instantiate() script to duplicate gameObject, genOrig once on a random point between 4 and -4 on the X-Axis. Simple enough, right? However, when I start the script, Unity creates a clone of the game object every frame, like an Update() message.
Here’s my code:
using UnityEngine;
using System.Collections;
public class GenerationScript : MonoBehaviour {
public GameObject genOrig;
public Quaternion rot;
public float posX = Random.Range(-4f, 4f);
// Use this for initialization
void Start () {
Vector3 position = new Vector3 (posX, 0, 0);
Instantiate (genOrig, position, rot);
}
// Update is called once per frame
void Update () {
}
}
I suspect something strange is calling Start() every frame.
Help please?