Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

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:
    250
    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:
    1,420
    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.