Forum rules - please read before posting.

Generate Hotspots using Unity Editor Script, Examine and Unhandled Inventory buttons problem

Hi, I'm using Unity Editor Scripting to dinamically create a new scene from scratch.
I have some trouble adding Hotspot Interactions.
I'm following these steps to create an hotspot:

1) Instantiate a gameobject, attaching to it a Hotspot Component
2) Instantiate a gameobject, attaching to it Interaction Component for "Examine interaction"
3) Instantiate a gameobject, attaching to it Interaction Component for "Unhandled Inventory interaction"
4) Instantiate a gameobject, attaching to it Interaction Component for "Use interaction"

Steps 2,3,4 are done by using these piece of code:

`

    //ac_hotspot_component.useButton = new AC.Button();
    ac_hotspot_component.useButton.faceAfter = true;
    ac_hotspot_component.useButton.playerAction = AC.PlayerAction.WalkToMarker;
    ac_hotspot_component.useButton.interaction = hotspot_Use_CS;
    ac_hotspot_component.useButton.isDisabled = false;

    //ac_hotspot_component.unhandledInvButton = new AC.Button();
    ac_hotspot_component.unhandledInvButton.faceAfter = true;
    ac_hotspot_component.unhandledInvButton.playerAction = AC.PlayerAction.WalkToMarker;
    ac_hotspot_component.unhandledInvButton.interaction = hotspot_UseInv_CS;
    ac_hotspot_component.unhandledInvButton.isDisabled = false;

    //ac_hotspot_component.lookButton = new AC.Button();
    ac_hotspot_component.lookButton.faceAfter = true;
    ac_hotspot_component.lookButton.playerAction = AC.PlayerAction.WalkToMarker;
    ac_hotspot_component.lookButton.interaction = hotspot_LookAt_CS;
    ac_hotspot_component.lookButton.isDisabled = false;

`

When I inspect the Hotspot it miss the "unhandled" and "examine" behaviour.
If I click to the "+" buttons then the interaction appear correctly configured as you can see in the video attached.

Why these 2 actions are not visible like "Use" one?

Am I missing something in the code?

Thx in advance.

Comments

  • Welcome to the community, @nova1337.

    You just need to update the Hotspot component itself with:

    ac_hotspot_component.provideLookInteraction = true;
    ac_hotspot_component.provideUnhandledUseInteraction = true;
    

    Its entry in the Scripting Guide can be found here.

  • Thanks! Happy and glad to be here.

    The solution provided worked!

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.