Manipulating a GameObject / Component that has not been specified in the inspector
If you try to get a component that isn't there and then, try to access it:Retrieving a component that isn't attached to the GameObject and then, trying to manipulating it:
Accessing a GameObject that doesnt exist:Accessing an element of a non-initialized array
private GameObject[] myObjects ; // Uninitialized array
private void Start()
{
for( int i = 0 ; i < myObjects.Length ; ++i )
Debug.Log( myObjects[i].name ) ;
}
Accessing a GameObject that doesnt exist:
Trying to use the result of a getter that's returning null:Trying to use the result of a getter that's returning null:
Less common, but annoying if you don't know it about C# delegates:Accessing an element of a non-initialized array
private GameObject[] myObjects ; // Uninitialized array
private void Start()
{
for( int i = 0 ; i < myObjects.Length ; ++i )
Debug.Log( myObjects[i].name ) ;
}
Less common, but annoying if you don't know it about C# delegates: