Search Unity

Need Help Regarding 'DontDestroyOnLoad'

Discussion in 'Scripting' started by Jackk_, Nov 18, 2017.

  1. Jackk_

    Jackk_

    Joined:
    May 2, 2017
    Posts:
    49
    when I start up the game and log in, bare in mind that the server is functioning perfectly in terms of connecting to the database, adding and loading my UMA (my character model). But I've followed every step of the tutorial up to 18:43 but my game should add a second player called 'Player-2' but for some reason it is not able to add it, my thoughts are that because Yasil (the creator of the tutorial) has no 'DontDestroyOnLoad' file in his hirearchy that he must have removed it for a reason, but It won't let me remove it so I was wondering A: If DontDestroyOnLoad could cause this sort of issue and B: How do I remove it if it is causing the issue, as it wont let me delete it on the hierarchy and it only appears when I login to my account, not on the login screen.

    Here is a screenshot of my game after I login to a registered account


    If anyone could give me some insight I would greatly appreciate it
     
  2. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    I don't really think there's enough information to go on to say whether that's your problem or not.
    However, if you want to destroy that object, find it in the code and either disable the dontDestroy portion and/or set that object(s) to be destroyed.
    What is even in the DontDestroyOnLoad in the hierarchy? It's not expanded in your screenshot.

    I'd just try to make sure you didn't miss something about loading the character.