Camera getting destroyed after start

Options

For some reason, today my game started to load 10 times longer, and then Unity says "Display 1 No cameras Rendering", then i checked, and saw that cam got deleted, one time i even managed to rotate it fir a sec, and then it died.

Answers

  • L0g0Z0g0
    Options

    I figured it out a bit, the problem is with my player instantiation script. I can't copy it right now, so i will publish it tomorrow. Please help me.

  • L0g0Z0g0
    Options

    I partly got it, the problem with Photon View, as soon as i add it to player prefab, game freezes on start!

  • L0g0Z0g0
    Options

    Here is my code

    public GameObject capsule;

       public GameObject cam;

       // Start is called before the first frame update

       void Start()

       {


          

           CreatePlayer();

       }


       // Update is called once per frame

       void CreatePlayer()

       {

           //

           capsule = PhotonNetwork.Instantiate(capsule.name, new Vector3(0, 15, 0), Quaternion.identity);

           capsule.name = PlayerPrefs.GetString("nic");

          

           capsule.GetComponent<Example>().enabled = true;

           

         

           cam.transform.SetParent(capsule.transform);

           

       }

    }