Forum rules - please read before posting.

Hotspot highlight shape based on collider

Is it possible to use a hotspot's collider (rather than a SpriteRenderer) to specify what shape to use during hotspot highlighting?

Here's an example of someone doing something very similar for both BoxCollider2D and PolygonCollider2D:
https://gamedev.stackexchange.com/questions/197313/show-colliders-in-a-build-game-in-unity

Thanks!

Comments

  • If you uncheck a Highlight component's Auto-brighten materials when enabled?, then the default highlighting effect will be disabled - and you can read the component's GetHighlightAlpha value to apply a custom effect through script.

    For example, you could control the LineRenderer created in your linked thread by affecting its color's alpha channel:

    void Update ()
    {
        AC.Highlight highlight = GetComponent<AC.Highlight> ();
        float alpha = highlight.GetHighlightAlpha ();
    
        LineRenderer lineRenderer = GetComponent<LineRenderer> ();
    
        Color startColor = lineRenderer.startColor;
        startColor.a = alpha;
        lineRenderer.startColor = startColor;
    
        Color endColor = lineRenderer.endColor;
        endColor.a = alpha;
        lineRenderer.endColor = endColor;
    }
    
  • edited April 2023
    Interesting, do you know of a way to fill the shape so that its not just the outline that is displayed?

    Any chance of a feature like this being part of AC in the future? Like you, I'm trying to prioritize all the items on my todo list :)
  • I'd look into the use of a custom shader via Shader Graph, myself. One that takes a Float parameter to control the effect, which can be set using the same function as above.

  • edited April 2023
    Interesting, well this feature has my vote for an upcoming release. Would be great to just have the collider and be done with itπŸ‘
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.