Just a small tip I’d like to leave here: I haven’t seen the rest of the course yet, but it is usually simpler and less error-prone to use a specific script when referencing the Prefab instead of the Transform - in this case it would be GridDebugObject
So, in Testing.cs you would have
[SerializeField] private GridDebugObject debugPrefab;
The main advantage is that you can only assign prefabs containing the component to that field. So you won’t get an issue when trying to get it later. And in GridSystem.cs, you could have
public void CreateDebugObjects(GridDebugObject debugPrefab)
When you instantiate the debugPrefab
, you no longer need to get the component. If you need the transform you can always do gridDebugObject.transform
Not sure if this has any drawbacks though, so please reply if you know of any. Thanks!