Forum rules - please read before posting.

Prefab variables lost on player switching

edited July 2019 in Technical Q&A

Here's a problem I'm seeing with variables stored on player prefabs:

  1. Add a Variable and a Remember Variable component to a player prefab
  2. Add a variable to the prefab (name:IsFoo, initial value:false)
  3. In-game, set the IsFoo variable to true using Variable:Set
  4. Switch to a player in another scene
  5. Switch back to the original player
  6. The IsFoo variable is now set to false

Thanks

Comments

  • I will investigate.

  • edited July 2019

    I cannot reproduce any such issue - can you offer any more details? Please also be sure to always provide both AC and Unity version numbers when posting.

    Is Retain in prefab? checked in the Remember Variables component?

  • How strange. It's a bit hard for me to reproduce right now because I moved all my player prefab variables to global variables due to both this issue but most of all the inability to do global searches for variables placed in prefabs.

    AC 1.68.3
    Unity 2019.1.10

    Yes, Retain in prefab was checked.
  • I remember that the player prefab that had the Variables component was set to the default player. The player:switch used replace npc for both the players.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.