0
Under review

The "Attributes UI" does not work when I use it via a global variable.

markusrgb 3 months ago in Stats updated by Marti (Lead Developer) 3 months ago 4


Hello, everyone,

the "Attributes UI" does not work when I use it via a global variable.

I use the Global Variable to temporarily refer to enemies or trees etc.

When I look at a tree object to which the global variable currently points, the attribute is displayed correctly.

However, it does not synchronize with the life display in the canvas.

if I do the same with the player as the target, it works without problems

the upper life display is that of the player, the lower life display is that of the game object to which the global variable refers.

thanks a lot

Markus


Unity version:
2019.4.01F
Game Creator version:
1.1.9

Okay, 

I have tested it again now and also took a closer look at the examples.

Basically I am doing everything right.

It works e.g. with the player without problems.

But if I use a global variable that can change during the game, it doesn't work anymore.


I tried to create a display that shows me the HP values and the name of the enemy near me on the UI.

Unfortunately this method does not seem to work!


Unfortunately I can't find any other way to do this either.

...

Is there another solution to this problem?

In the meantime, I may have found a way to display the numerical values of the attributes of the ever-changing enemies or objects on my user interface:

I assign an empty object to the "attribute UI" in my UI canvas as a fixed target. This empty game object has a "Stat" component.

When I interact with an object, I assign the numeric attribute values to a global variable.

Then I use a trigger that reacts when one of these global variables changes. This then resets the attribute value in my UI canvas with the value of the empty game object.

This is very cumbersome, but so far it works.

However, I still consider it a bug that "Attributes UI" does not work with changing global variables at runtime. It would make things a lot easier. ;) 

Under review

Sounds like something's not right with the Global Variables. I'm opening a ticket to have a look and I'll circle back as soon as I have some news