Hi so I have a predicament, Im quite new to unity and coding in general, but I have been making a block stacking type game and so far I have been able to solve most problems.
But I have reached a point where I am completely stuck. So far I have blocks that spawn in at various spawn points above the camera and fall down with the option to move them left and right and then input ceases once they hit the floor or another block.
My issue is I wanted to have a height measuring system in place for a high score, the best way I could think of was to put all spawned objects into a list once they had hit another object. At the moment my BlockSpawner script sits on a game object in the scene and the blocks are prefabs that are not in the scene until the game runs.
Now that’s the bit Im stuck on I wanted the blocks to add themselves to the list in a different script that is attached to a different object and it has to work for all prefab clones that spawn, but I have no idea how!! I have looked at many videos and forum posts about using variables from other scripts but nothing seems to work so far.
Sorry for the long post any In detail explanation would be appreciated or even links to other posts that answer the question would be very much appreciated