Forum rules - please read before posting.

Highlight - Is it possible to make it affect an intensity value?

Unity Ver: 2019.4.35f1
AC Ver: 1.74.5

Hello AC community,

Forgive me, I'm not too clued-up on how the highlight component works however, would it be possible to make it affect an intensity value on a shader?

My setup is I have a parent gameobject with the highlight component, and a TMP & Font Text Material on a child, like so:

What I'd like to do is have the highlight affect the intensity value of the material / shader to produce this effect:

Is that possible?

Comments

  • You can read the Highlight component's GetHighlightIntensity through script, and apply it to your material, e.g.:

    myMaterial.SetFloat ("Intensity", myHighlight.GetHighlightIntensity ());
    

    You'll need to make sure that your material's shader has a matching float property to affect - in this case, "Intensity".

  • edited February 2022

    Thanks Chris. After a bit of research it seems when dealing with TMP objects that material presets, and swapping between them, is the best practice when it comes to modifying the look, so I've decided to at least give that a go first.

    I thought plugging the swaps into the custom events of the highlight would be a good plan.

    The problem I've hit is that the custom events on the highlight don't seem to be firing when .Flash(); is used.

    Here's my setup:

    I've got a script which has public functions for the material swaps, along with some simple logging:

    The custom events on the highlight component are linked to those public functions:

    During play, when I do .Flash() on the highlight component, I don't get any logging, which suggests the functions aren't being run / events aren't firing.

    Might be a bug?

  • The Highlight and Flash effects are treated as separate processes, but I can that the expected behaviour would be for them to work as one. I'll see if the two can be merged in this way.

  • Thank you. I appreciate that.

  • Just a follow-up. Using the new behaviour, I've managed to use the events to do a material swap on the TMP text when .Flash() is used.

    Thank you for adding this.

  • Looking good!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.