- Home /
Question by
superprogamer77 · Jun 21, 2020 at 09:39 AM ·
arrayarraysclassclassesobject-reference-error
Getting an error trying to assign a value to an array of classes element
When i try to assign a value to an element of the array of classes i get the "Object reference not set to an instance of an object" error.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Test : MonoBehaviour
{
public TestClass[,] TestArray;
void Start()
{
TestArray[0, 0] = new TestClass();
}
}
public class TestClass
{
}
Comment
Your answer
Follow this Question
Related Questions
adding classes to arrays 2 Answers
C# Class and Array 1 Answer
Problem with arrays in a list 1 Answer
Instantiating objects from a class? (C#) 1 Answer
Why Again Arrays In ExecuteInEditMode() Gives NullReferenceException Errors?? 1 Answer