Forum rules - please read before posting.

Triggering highlight component for inventory actions only?

I'd like to use AC's highlight component to brighten the material of hotspots, but only when I drag an inventory item onto an object, not with a regular mouse-over. A similar effect is used in Double Fine's Broken Age - what I'm looking for is on the hotspot, not the Active FX of the inventory pointer. Is there a simple way to achieve this?

Comments

  • edited November 2020

    You can attach a component to the scene that hooks into the OnInventorySelect and OnInventoryDeselect events, and updates all Highlight components in the scene accordingly:

    using AC;
    using UnityEngine;
    
    public class InventoryOnlyHighlight : MonoBehaviour
    {
    
        private Highlight[] highlights;
    
        private void Start ()
        {
            highlights = Object.FindObjectsOfType <Highlight>();
            OnInventoryDeselect (null);
        }
    
        private void OnEnable ()
        {
            EventManager.OnInventorySelect += OnInventorySelect;
            EventManager.OnInventoryDeselect += OnInventoryDeselect;
        }
    
        private void OnDisable ()
        {
            EventManager.OnInventorySelect -= OnInventorySelect;
            EventManager.OnInventoryDeselect -= OnInventoryDeselect;
        }
    
        private void OnInventorySelect (InvItem invItem)
        {
            foreach (Highlight highlight in highlights)
            {
                highlight.brightenMaterials = true;
            }
        }
    
        private void OnInventoryDeselect (InvItem invItem)
        {
            foreach (Highlight highlight in highlights)
            {
                highlight.brightenMaterials = false;
            }
        }
    
    }
    
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.