Answer the question
In order to leave comments, you need to log in
How to attach a camera to an object created from a prefab?
The problem is this: the camera has a script, the script has a public Transform target variable, I dragged the 'Hero' object from the hierarchy through the Unity interface. Everything worked as it should.
Then the structure changed a little: at the start of the Hero object, a 'Spaceship' child object is created from the prefab, and I wrote target = heroManager.Instance.Spaceship in the camera script;
As a result, at the start, the camera flies far away, where there are not even any objects, although in the inspector it has target == Spaceship
What am I doing wrong?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question