Check if GameObject[i] is null

I’m trying to assign game objects into empty spaces in an array during play mode. I’ve noticed there is nothing like gameObject.isNull. The only isNull is for string so I’ve experimented with that but obviously it didn’t like me referencing empty game object.

So my question is if I can check if the space in GameObject array is NULL.

My failed attempt at that:

1 Like

It’s not exactly a solution, more like a roundabout, but I figured that if I create array of booleans each corresponding to game object I can set them to true once something is assigned to game object and false if empty.

You should be able to do a type comparison between the Const Null node and what you wanna check as null.

I haven’t tested this, but I suspect it’ll work.

EDIT: Changed from Type to GameObject comparison.

1 Like

This will be very useful, thanks a lot! :slight_smile:

1 Like