Question by
Jermainek369 · Apr 12, 2016 at 04:40 PM ·
instantiateinheritance
Hi, im new to Unity i was coding and everything works until i get the message:
using UnityEngine; using System.Collections;
public class MysteryCube : MonoBehaviour { public MysteryCube[] magicCubes;
public virtual void MysteryFunction()
{
Debug.Log ("I am not so mysterious ");
}
void Update ()
{
if (Input.GetKeyDown (KeyCode.Space))
{
foreach (MysteryCube cube in magicCubes)
{
cube.MysteryFunction ();
// This is the code where i get the error
}
}
}
}
Comment
what's the error message?
please format ALL of the code too...
Object reference not set to an instance of an object.
that is all the code for the one script, the other scripts all inherent from this one
Your answer
Follow this Question
Related Questions
Question About Unity Class Hierarchy 3 Answers
My components are disappears 1 Answer