Page 1 of 1

Set Game-Object transform / color

Posted: Fri Sep 21, 2018 10:20 am
by CricketSaysChill
Hello again! How would I go about changing the transform values for several game-objects mid dialogue?

I have several game-object UI elements (UI Buttons and Images, etc on a canvas) serving as my game's HUD. Ideally I would like to have them change their rect-transform scales, rotation or image colors when the Player makes a good or bad decision during dialogue so that these choices are reflected in a more active way during gameplay. I.E. the hp bar's image color grows lighter or darker depending on the moral choices the Player makes. Or a mini-map that grows slightly larger (scale 1.1 instead of 1) if the Player opts to take a certain item and so on.

What would you reccomend to achieve this?

Thank you for your time.

Re: Set Game-Object transform / color

Posted: Fri Sep 21, 2018 1:56 pm
by Tony Li
Hi,

I recommend writing a custom sequencer command. If you don't mind a little C#, they're easy to write, and there's even a starter template script that's commented with instructions.

Re: Set Game-Object transform / color

Posted: Sun Sep 23, 2018 9:47 am
by CricketSaysChill
Thanks for the response. Just wanted to post an update for future references sake.

I couldn't figure out the custom sequencer business since C# may as well be an alien language for me. But I achieved what I wanted by attaching an animator to my HUD parent game-obect with seperate animations for the different variant child objects in their different states. Then I just used the AnimatorPlay sequence command to change the current hud animation to the variant I want to be active right now. It was so obvious I can't believe I didn't think of it right away. :)

Re: Set Game-Object transform / color

Posted: Sun Sep 23, 2018 10:34 am
by Tony Li
Nice solution!