Null Ref on Pathfinding script for the DebugObject Transform

Hey,

I am getting a null ref on my pathfinding script Awake where we gridSystem.CreateDebugObjects(gridDebugObjectPrefab);

It is assigned in the inspector and I have no other errors. They do not get instantiated at all.
image


image

It’s probably something glaringly obvious that i have just missed by overthinking and staring at it too long.

Thanks!

The null reference exception is for gridSystem. It’s null. You are creating a grid system, but you are not assigning it to the gridSystem variable. You need to have

gridSystem = GridSystem<PathNode>(...); // truncated

on the first line of Awake()

2 Likes

I knew it would be something completely dumb. I stared at it for so long :sweat: Thank you!

We’ve all made this mistake more than once over the years. That’s exactly how @bixarrio knew how to spot it. It seems so obvious once it’s pointed out, but it’s not always so obvious in the moment.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms