Search Unity

DontDestroyOnLoad objects cannot be linked with regulars??

Discussion in 'Editor & General Support' started by deLord, Feb 11, 2019.

  1. deLord

    deLord

    Joined:
    Oct 11, 2014
    Posts:
    306
    Can someone explain me why I cannot link an object that has DontDestroyOnLoad with an object which hasn't (during runtime via the Editor)?
    Like, I have a public Joystick variable in my Player class. Then I start the game and my Player class which is DDOL can then not be referred to the Joystick object which doesnt have it. I cannot drag&drop the Joystick into the variable.
    How can I circumvent this and more importantly, what is the reason behind it?
     
  2. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,627
    Technically, DontDestroyOnLoad Objects are moved to their own separate scene at run time, and you cannot connect references across scenes in the editor.
     
    karl_jones likes this.