Searching answer

Attribute UI not updating when using global variable

Sander 2 months ago in Stats updated by Marti (Lead Developer) 2 months ago 3

I've made a simple UI with the stats of the enemy my mouse is hovering over. When using target game object and dragging the object in, the stats work. However, when using global variables, it doesn't. I have a global variable with the game object that was selected. 

Unity version:
Game Creator version:

I think I found the problem. when the attribute UI component is initialized, the target is set at Start(). What I tried to do was change the target in run-time. I've fixed this by making a prefab and instantiating this when the target changes. And destroying the old version of the stats.  

Ok, this doesn't work either. Kinda stuck now. In the end I want to make a stat show in the canvast based on hovering over an object. I wanted to avoid having to make the same amount of stats as I have enemies. Isn't possible to change the source of the attribute UI in run time?

Searching answer

Hi Sander; sorry for the late reply. Changing the variable referenced by the Attribute UI is not possible, but you should be able to change the value of the variable and the Attribute UI should automatically pick the change.

I'm opening a ticket to investigate this further. How you've set up your Attribute UI makes sense and should work just fine. I'll circle back!