Selection portrait for strategy game

R3ZOfficialR3ZOfficial Posts: 3Member
edited February 5 in Programming

Hey! Im looking for an efficient solution to a selection portrait similar to most strategy games out there.

I thought of using a Global variable, which changes the Texture string on each selection. However, I would have to code the
Global.portrait = blabla.png on each building, unit etc...

So I have a global Variable with the intended path to the texture I want.
In addition I have to change the GUI sprite into that path now. thats an additional line on each Unit/building etc...
I looked for a "do this when variable changes" function but couldnt find any.

(I think the optimal would be something like "When global.variable changes value set GUI.sprite to global.variable path")

Is there any efficient solution to this?
Sorry Im a beginner and often times my way of doing things is very "workaroundish" and this time I wanted to do it as simple as possible



Tags :
Sign In or Register to comment.