Forum rules - please read before posting.

FlashHotspots Not Working, Highlight is

edited January 2023 in Technical Q&A

Good morning,

Unity: 2022.2.2f1
AC:1.76.1

I have my character set up for detecting hotspots by vicinity and interacting with a button press (InteractionA). That all is working great.

I am able to get the Highlight to work when I go inside of a hotspot. However, when I add FlashHotspots to the input Manager it doesn't highlight the hot spot when the button is pressed. I have tried mapping it to space, tab, and q.

Also a second question.
I am not wanting to show the Hotspot names. (That's why I am using the highlight functionality). I searched the forums and found a code snippit that you posted. It sort of works.
https://adventurecreator.org/forum/discussion/4917/no-label-over-a-hotspot
What happens is that when I leave the trigger the hotspot name flickers briefly on the screen. 'Use HotspotName'

This video shows both problems as well as the input manager for FlashHotspots. Thanks for your time.
https://youtu.be/B-L-WFyr3EM

Comments

  • I am able to get the Highlight to work when I go inside of a hotspot. However, when I add FlashHotspots to the input Manager it doesn't highlight the hot spot when the button is pressed.

    I'll need a few details of the way your Highlight effect is set up. Can you share screenshots of a typical Hotspot, its linked Highlight object/component, as well of details of the material/shader/render pipeline involved?

    I am not wanting to show the Hotspot names.

    Have you tried just locking the Hotspot menu from within the Menu Manager, as metnioned in the linked thread?

  • edited January 2023

    Thanks for the reply. See below answers.
    1. Yes I tried the HotSpot locked off. Screen shot of those settings below.
    2. I am using URP with ProPixelizer.
    3. Sorry not sure why adding an image url wasn't working for me.

    HotSpot
    https://flic.kr/p/2od2EBq

    HotSpot Locked Off
    https://flic.kr/p/2od2K3K

    Highlight
    https://flic.kr/p/2od1Hek

    Shader Values
    https://flic.kr/p/2ocWN5Z

    Appreciate your help.

  • Yes I tried the HotSpot locked off. Screen shot of those settings below.

    What was the result of this? Bear in mind that you if you have custom scripts involved (such as Disable Hotspot Label on your Hotspot), then it may conflict. Does the Hotspot label disappear completely if you lock the Menu and disable this component?

    I am using URP with ProPixelizer.

    The built-in Highlight effect works by modifying the "_Color" property of the object's Material - but this may not be correct in the case of this particular shader.

    You can override this property name with the Settings Manager's Highlight material override field, under the "Hotspot settings" panel. Try setting it to "_BaseColor" or "_OutlineColor".

    If that doesn't work, it may be worth contacting the author of the shader for advice about which property you should affect.

    If it's not possible to update a shader's colour this way, it's possible to have the Highlight call custom script functions to implement the effect through completely custom means - which can be done by checking the component's Call custom events? option.

  • Thanks for your continued support.
    You were spot on with the HotSpot Label. When I locked Hotspot through the menu and had the disable script attached I was still getting the same issue. Remove the script and it's working fine.

    I updated Highlight material override to to each field and as before I can trigger the highlight just fine when walking into hotspot. However when I'm not in the hotspot and holding trying to use FlashHotSpot nothing happens.

  • Ok this one is solved. I dropped the ProPixelizer for now and only using URP and AC. Once I have some base functionality in place I will pull it back in so I can make sure I do things correct. Thanks again for you advice.
    One last Question about hot spots. Is it possible to have some hot spots able to be activated with vicinity only. Others by mouse over only. In my case this would be dependent on if my character is in first or third person view.

  • Ok I fibbed. A second question. Instead of the item linked to the hotspot highlighting. Instead could it be a UI element?

  • Is it possible to have some hot spots able to be activated with vicinity only. Others by mouse over only.

    The Hotspot detection method is a game-wide setting, but you can modify it through script. To access any Manager field at runtime, right-click the field's label to copy an API reference to it.

    However, it is also possible to assign an "Interactive boundary" to Hotspots, which will be respected regardless of the detection-method. This boundary is a Trigger collider attached to the Hotspot - if set, the Hotspot will only be interactive if the Player is within this boundary.

    Instead of the item linked to the hotspot highlighting. Instead could it be a UI element?

    To disable the automatic highlighting effect, uncheck Auto-brighten materials when enabled? in the Highlight's Inspector.

    To replace this with a UI effect, you have a couple of options.

    The quick-and-easy way is to configure the Display Hotspot icons option in the Settings Manager's "Hotspot settings" panel. This can be set to Only When Highlighting to sync it with a Hotspot's highlight state - even if the default highlight effect is disabled.

    For something more complex, you can rely on a custom script to diplay an effect of your choosing. To sync a custom effect with the Highlight, you can either use the custom events method I described above, or have your script read the Highlight component's GetHighlightIntensity function.

  • Great answers and much appreciated.

  • edited January 2023

    I was over thinking part of this... In huge ways. I have a variable that separates the two states. So check for the variable at the in the hotspot interaction and that will only allow it to be used based on if I am in first or third person.

    I was looking into the custom events you mentioned and I was having a hard time figuring out a solution. I saw your example for the get speech and read through the event manager but didn't see anything that I thought would work.

    I even tried something simple like changing the color of the raw image in a canvas when a hot spot was activated/mouse over using the OnHotspotSelect and OnHotspotDeselect without any luck.
    Any advice?

    Basically the functionality I am wanting is when the character detects a hot spot either through mouse over or vicinity a ui element lights up letting them know.

  • Here's a sample script you can try out:

    using UnityEngine;
    using AC;
    
    public class CustomHighlight : MonoBehaviour
    {
    
        public Hotspot associatedHotspot;
    
        private void OnEnable ()
        {
            EventManager.OnHotspotSelect += OnHotspotSelect;
            EventManager.OnHotspotDeselect += OnHotspotDeselect;
        }
    
        private void OnDisable ()
        {
            EventManager.OnHotspotSelect -= OnHotspotSelect;
            EventManager.OnHotspotDeselect -= OnHotspotDeselect;
        }
    
        private void OnHotspotSelect (Hotspot hotspot)
        {
            if (hotspot == associatedHotspot || associatedHotspot == null)
            {
                Debug.Log ("Select: " + hotspot, this);
            }
        }
    
        private void OnHotspotDeselect (Hotspot hotspot)
        {
            if (hotspot == associatedHotspot || associatedHotspot == null)
            {
                Debug.Log ("Deselect: " + hotspot, this);
            }
        }
    
    }
    

    If you assign a Hotspot in its Inspector, it'll only kick in when that Hotspot is affected. Otherwise, it'll work for all. Is it showing Select/Deselect events in the Console at the intended times?

  • This did it. It is now detecting the hotspot. Now I am just reading up on how to work with UI elements etc.
    The color change works but isn't as impactful as I want.
    Thank you for your continued support.

  • edited January 2023

    I ended up just doing this and it gave me the best of both worlds.
    Thanks again.
    Also why does markdown act weird when I use the code tags.

    using UnityEngine;
    using AC;
    
    public class CustomHighlight : MonoBehaviour
    {
    
        private Animator animator;
        public Hotspot associatedHotspot;
    
        private void OnEnable ()
        {
            EventManager.OnHotspotSelect += OnHotspotSelect;
            EventManager.OnHotspotDeselect += OnHotspotDeselect;
        }
    
        private void OnDisable ()
        {
            EventManager.OnHotspotSelect -= OnHotspotSelect;
            EventManager.OnHotspotDeselect -= OnHotspotDeselect;
        }
    
        private void OnHotspotSelect (Hotspot hotspot)
        {
            if (hotspot == associatedHotspot || associatedHotspot == null)
            {
                animator = GameObject.Find("HSDetector").GetComponentInChildren<Animator>();
                Debug.Log ("Select: " + hotspot, this);
                animator.SetBool("isWhite", true);
    
            }
        }
    
        private void OnHotspotDeselect (Hotspot hotspot)
        {
            if (hotspot == associatedHotspot || associatedHotspot == null)
            {
                animator = GameObject.Find("HSDetector").GetComponentInChildren<Animator>();
                Debug.Log ("Deselect: " + hotspot, this);
                animator.SetBool("isWhite", false);
    
            }
        }
    
    }
    
  • edited January 2023

    Code just needs to be indented - no need for any tags. I've formatted this to your code above, thanks for sharing 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.