I’m having a tough time figuring this one out. I have been following some tutorials online for making player UI, and one thing that is used is a player map of the ui widget I made.
Then I have an init function that appears to work correctly. The playerHUDMap Length (or size) before the init function is 0, and after my character spawns with a spawn pad it’s a size of 1, which is correct.
Then in my other function, I’m calling to update the UI. There are two if statements that check if the persistent player data is available (this one succeeds) and the other if statement to try to grab the player hud widget reference (this one fails). This fails because the map is showing a size of 0 at this point. But this function is called after I’m spawned in and it was 1 earlier from the Print functions outputs outside of this Update function.
I can do that next time I’m loaded into and working on it for sure!
Can I ask a general question - do you think there’s a downside to have player spawners in one device (with their own subscribed OnPlayerSpawn functions and init_player functions) and then pass the player object from that device to another device’s function that takes the player data type? Because that’s how I was getting a player from the spawner - it comes from the player stats manager verse device and then goes to the player ui hud verse device.
Hey sorry I’ve been away from this for so long. I have a copy-paste of the output log from the output window while the playtest was running and I ran to collect 2 item boxes, which is expected to update the money value of the player in my map.
To focus on the parts of the Print outputs for the playerHUDMap here are two screenshots A and B for when the game starts a round with my player (A) and after I collected 2 item boxes (B) which would increase the currency counter value in the UI. The issue is the Map seems empty when it started out populated.
I am using multiple verse devices. One for player UI, one for item box system, separate verse file for player stats, a game manager
Ok I figured out one small thing I forgot and now it seems like it’s working AHA.
I had some verse devices involved: a player UI device, a player stats manager device, and an Item box manager device. The player stats has an @editable reference to a player UI device, and the item box manager has an @editable variable of the player stats manager. I was missing that last one, it wasn’t filled in, and I just found it out.
This was empty earlier lol. So that makes sense, because it was like there was no map or info from that device when it tried to call a function to update the UI after an item box is collected. The chain of events was broken in a way.
Lol yea it also has happened to me too in the past, I would be digging through the code just to realize the reason it didn’t work was because the devices were never linked
Happy to see you got it resolved though regardless