When to create player GUI

Place to get help with not working mods / modding interface.
Post Reply
dementedpeanut
Burner Inserter
Burner Inserter
Posts: 5
Joined: Mon Aug 03, 2020 1:56 am
Contact:

When to create player GUI

Post by dementedpeanut »

I am pretty new to this and am struggling to find resources for GUI!

From what I understand GUI needs to be created for each player after 'on_player_created' but not before the first game tick. My current solution is to index each player that needs the GUI creating in the globals variable and then initialising each player either after the first tick or when a new player is created.

Is there a better solution to this or a built in function that can achieve the same thing?

Thanks

mrvn
Smart Inserter
Smart Inserter
Posts: 5710
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: When to create player GUI

Post by mrvn »

I create the GUI in the opened event and destroy it in the close event. But it's a dynamic GUI for an entity so every time you open it the contents needs to be synced to the specific entity clicked. Creating the GUI from scratch is easier than updating it.

Post Reply

Return to “Modding help”