Set Game-Object transform / color

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
CricketSaysChill
Posts: 5
Joined: Tue Sep 11, 2018 10:54 am

Set Game-Object transform / color

Post 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.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Set Game-Object transform / color

Post 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.
CricketSaysChill
Posts: 5
Joined: Tue Sep 11, 2018 10:54 am

Re: Set Game-Object transform / color

Post 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. :)
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Set Game-Object transform / color

Post by Tony Li »

Nice solution!
Post Reply