I use some code to procedurally paint the terrain. But for some reason the splatmap variable sometimes becomes smaller or I atleast get a error with the current iteration being out of range.
Error:
IndexOutOfRangeException: Array index is out of range.
(wrapper managed-to-managed) object:ElementAddr (object,int,int,int)
PT+$UpdateTile$72+$.MoveNext () (at Assets/Scripts/PT.js:272)
UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator)
$:MoveNext() (at Assets/Scripts/PT.js:98)
UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator)
StartMenu:SpawnPlayer() (at Assets/Scripts/StartMenu.js:716)
StartMenu:OnGUI() (at Assets/Scripts/StartMenu.js:273)
and for some reason when doing a check like the code below, it is the first line that returns the error, why doesn’t that line prevent the error from occuring, since if it is out of range, it should be null right?
if (map[z,x,0] != null) { //For some reason it is this line that gives a null
map[z,x,0] = 1;
}