Forum rules - please read before posting.

Hotspot on Player character

Hi folks, do you know how to have a hotspot on the main character?
I tried to put the component Hotspot + a trigger Box Collider on my Player prefab but it doesn't work... something I should know about it?
Thanks a lot

Comments

  • If you've enabled Player-switching in the Settings Manager, then the Auto-sync Hotspot state? option in your Player Inspector will determine if their attached Hotspot is automatically turned off and on based on whether they're the active Player or not.

    If the option is unchecked, or you do not rely on Player-switching, then the Hotspot should behave as normal. Is this for a 2D or 3D Player character, what object/child are the components attached to, and what layer is the object on?

  • Hey Chris, thanks for the answer, it's for a 2D game and I'm using the player switching. I just disabled the Auto-sync hotspot state and it's working! Thanks a lot

  • Hey Chris, I too wish to use inventory items on player using a Hotspot on him. But in my case I don't have any Player-Switching in the 2D game. My games Interface interaction method is set to Context Sensitive, it's just running on single clicks. Any guidance on how I can make it to work?

  • If you want to make the Player character interactive, you can add a Trigger Collider and Hotspot component to the Player as with a regular object in the scene.

    For a 2D game, it might be best to add these to a child object, making sure Turn root object in 3D? is unchecked in the Player's Inspector.

    This'll make the Player interactive at all times, however. If you want them to only be interactive while an Inventory item is selected, attach this script to the Player's Hotspot:

    using UnityEngine;
    using AC;
    
    public class UpdatePlayerHotspot : MonoBehaviour
    {
    
        void Update ()
        {
            if (KickStarter.runtimeInventory.SelectedItem != null)
            {
                GetComponent<Hotspot> ().TurnOn ();
            }
            else
            {
                GetComponent<Hotspot> ().TurnOff ();
            }
        }
    
    }
    
  • The character is instantiated during runtime, I've attached a Hotspot to a separate Game object a child of the Player prefab. I also made sure that box collider2D is set as a trigger & attached the script. However, I don't see any thing when I hover my mouse cursor with the inventory item selected over the player. When I do click on the player, I just see a Use for a fraction of second, but the actions don't run.

  • edited February 3

    Your video shows the behaviour, but not the objects that cause it. Please share screenshots showing the Player's full root Inspector, that of the Hotspot child, and any ActionLists it references.

    Be aware that, as the Player is spawned at runtime, their Hotspot's Interaction source field must be set to Asset File.

  • edited February 3

    It works now as expected, I was not using any Asset File for getting the expected functionality to work. Also I was trying to use a USE interaction instead if Inventory Interaction. However, I still don't see any type of mouse over feedback, I can't see any Hotspot Label name when I try to hover over the player with the inventory item selected. In the player Hotspot I've set the label name to just a space no text.

  • No problem now, I've entered the player Hotspot label to Self, and it seems to get the job done just fine.

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.