Hello,
I started using Unity a few weeks ago, and until now I barely had problems with it. I started to arrange my objects into prefabs, so I can place them whenever I want. Then I encountered the following:
I have prefabs of everything including gameHandler (controls most of the game), mainCharacter, mainCamera, a torch, a spike, different types of walls, ground, etc. Some of them have attached scripts, like mainCamera. In the mainCamera script there is a reference to the player character, with the prefab from the asset files connected to it:
public GameObject playerCharacter;
With this method I can connect every prefab which needs a reference without moving it to the scene, but when I move them to the scene via the editor, it seems like it creates another object, which means I need to change the reference to that particular object. For the prefabs which does not exist on the scene I cannot connect onscene objects, only prefabs (assets). Thats the case with spike, which has a reference to gameHandler. Spike does not exist on the scene on start, only instantiated later, so I can only connect the prefab gameHandler to it, but that is not the same as the onscene version.
Thanks for any help!