The variable thing of SomeScript has not been assigned.
Right so i am currently trying to spawn two prefabs whenever the function spawn is run. The issue I keep encountering is that the Cube variable in this script comes back as unassigned. I am at a loss currently and am curious if the error is within the script or the prefab. Any help is appreciated.
The script: using UnityEngine; using System.Collections;
public class Cubes : MonoBehaviour {
public float delay = 0.1f;
public GameObject Cube;
public GameObject Point;
// Use this for initialization
void Start () {
InvokeRepeating("Spawn",delay,delay);
}
void Spawn () {
Instantiate(Cube,new Vector3(Random.Range(-6,6),10,0),Quaternion.identity);
Instantiate(Point,new Vector3(Random.Range(-6,6),10,0),Quaternion.identity);
}
}
Are you certain that the variable cube is actually set, can you see it in the inspector before the Spawn methods runs?
I do believe that this is what you mean http://prntscr.com/90yiy8 if so then yes.
I meant on whatever object in the scene has this script attached. As that is the object on which the script will be running. The inspector in your screenshot looks like its of an asset in the Projects window not a Scene Object from the hierarchy.