Search Unity

  1. Click here to see what's on sale for the "Best of Super Sale" on the Asset Store
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Equiping stats modifinig item and loading into a game.

Discussion in 'General Discussion' started by Shobosa, Sep 11, 2019.

  1. Shobosa


    Jul 8, 2015

    thank you for taking the time to read this question. I am making a 3d based game that has a lobby system and an inventory area for player to add bonuses through gear. Once the player loads all the gear and joins the game the gear and bonus are not loading into the game with them. I like to learn on my own so I am not looking for someone to write my code. I am looking for someone to direct me to a tutorial or lesson where I can learn more about loading avatars into game base on the items they pick from the inventory.


  2. Anaxis_Studio


    Sep 7, 2019
    Once the player loads all the gear and joins the game the gear and bonus are not loading into the game with them.

    Are you using DoNotDestroyOnLoad for the objects you want the player to take with them into the next scene? Are you persisting data?

    You don't mention how experienced you are with Unity or exactly what your problem is regarding persistence. Yet, it sounds like you are making a multiplayer game so it's a little confusing how something so small is causing an issue.

    How are you associating these items/bonuses with the player? without knowing that it's almost impossible to help.

    I'm going to make a few assumptions in order to help (if I understand you correctly).

    So, you have a naked player and they start in Scene 1. This is where they can pick their clothes, weapons, bonus perks, etc. They then choose to "start game" and are subsequent loaded into Scene 2.

    Your issue is that, when they are loaded into Scene 2, it's as a naked player, not a player with the clothes/guns/perks they selected. Are you persisting data? if not that is your issue.

    Again, I have to stress there are multiple ways to do this so this is just one way you could "potentially" fix the issue.

    1) create an empty game object in Scene 1.
    2) create a new script "PlayerChoices" and attach it to that game object.
    3) fill this script with attributes for the player

    public int shirtColour;
    public int hairColour;


    4) When they player selects an option, store that data in the script. If they change their choice then update the variable.
    5) attach a DoNotDestroyOnLoad script to the empty game object.
    6) Voila. When you load scene 2 just load a player model based on the attributes from the "PlayerChoices" script.

    That tutorial is a bit old but it works for persisting data between scenes and between game sessions.

    I apologise if this is not what you were looking for but you provided little information.
  3. Shobosa


    Jul 8, 2015
    First thanks for your response. I know the editor, just not the code and I might be overestimating how much I can do with this editor. I am going to watch the tutorial and read the doc's you provided and see what I can do. thank you for the help.