Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Unity 2018.3 is now released.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    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:
    235
    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:
    585
    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.