Can someone please show me how I can get an array of floats working in Unity, here’s what I got so far, error in Unity is :
“NullReferenceException: Object reference not set to an instance of an object
test.Start () (at Assets/Script/test.cs:40)”
using UnityEngine;
using System.Collections;
class zzBallClass
{
public float[] x = new float[9];
}
public class test : MonoBehaviour {
zzBallClass sBall;
// Use this for initialization
void Start ()
{
sBall.x[0] = 1.1f;
}
void Update ()
{
sBall.x[0]++;
}
void OnGUI()
{
string sText;
sText = "Ball.x[0] = " + Ball.x[0].ToString();
GUI.Box(new Rect(300,20,130,20), sText);
}
}