Unity version: 2022.3.8f1
AC version: 1.81.3
So all my scenes have this button in the upper righthand corner - a button to access a journal, which contains clues and quests:
Once in a while, something will happen in the scene that leads to the journal having new information in it. For example, a character might assign you a quest.
What I want is for the Journal icon to somehow change - to pulsate, bounce insistently, light up, whatever - to alert the player to the fact that there is now new content in the journal for them to explore. Once they click the button to access the journal, when they leave the journal it should be static again. I'm not attached to any particular effect. I want to do whatever is fastest and easiest for playtesting purposes.
Here's how my journal is set up in the Menu, in case it's helpful: https://imgur.com/a/aUrxacZ
Currently, when a new item is added to the journal, the game changes some global variable (eg "JackQuestAssigned = true"). Maybe I could have code that listens to whether a particular global variable is changed, and run some sort of animation effect on this menu button when that happens. I'm just hoping I can get some pointers on the smartest approach here. Help would be greatly appreciated!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Firstly, you'll need to convert the Menu to rely on Unity UI. That way, you can then rely on an Animator component, attached to the Button, to control its animation (which can then be whatever you wish, using Unity's Animation window).
In the Animator window, add another (empty) animation, make it the default, and then use a Bool parameter to transition between this and the "light up" animation.
You can then use the Object: Animate Action to set this Bool to True when needed (and False when the Player clicks it), to control animation playback.
In terms of when this is set to True: you could rely on code that listens out for changes in a given variable value - but where possible, it's tidier to use the Event Manager. This lets you run ActionList when certain events take place.
If you were to rely on AC Objectives for such alerts, for example, you could hook into the Objective / Update event, so that the animation occurs automatically whenever an Objective's state is altered.
Super-clear instructions that deepen my understanding of AC. Many thanks!