- Home /
object not set to instance?
What does it mean my object reference isnt set to an instance of an object? The array is a public static variable in another class called BlockData. The error refers to the "foreach" loop line of code.
private void updateChunks() {
foreach(Transform curChunk in BlockData.currentChunk) {
if(Vector3.Distance(player.position,curChunk.position) < 20) {
chunksToRender.Add(curChunk);
}
}
renderBlock();
}
Comment
Best Answer
Answer by ScroodgeM · Aug 27, 2012 at 09:50 PM
rather of all BlockData.currentChunk is null, check it before foreach block using
Debug.Log(BlockData.currentChunk);
to be sure. the fix if it so.
Your answer
Follow this Question
Related Questions
The infamous: Object Reference not set to an instance of an object 1 Answer
Object Reference Not Set to an Instance of an object 0 Answers
"Object reference not set to an instance of an object" 2 Answers
Object reference not set to an instance of an object 1 Answer
Object reference not working 0 Answers