need to assign the Main Camera back to the parent Player
pulled out the camera using: GameObject.Find("Main Camera").transform.parent = null;
If you use your own code, then like this:
GameObject.Find("Main Camera").transform.SetParent(GameObject.Find("Player").transform); But GameObject.Find itself is advisable to use as rarely as possible. It is better to give the script direct links, or at least cache (i.e., assign the found file to the variable, so that you don’t look for it again through Find). those. something like this will come out:
var _camera = GameObject.Find("Main Camera"); var _player = GameObject.Find("Player"); _camera.transform.SetParet(null); _camera.transform.SetParet(_player.transform); Find ? - Kill NoiseSetParet you missed n you need SetParent - Kill NoiseSource: https://ru.stackoverflow.com/questions/776720/
All Articles
error CS1502: The best overloaded method match for 'UnityEngine.Transform.SetParent(UnityEngine.Transform)' has some invalid arguments- Kill NoiseGameObject.Find("Player")highlighted in red - Kill Noise