Forum rules - please read before posting.

Flash Hotspots button problem.

So I'm trying to get this script working in my scene:
https://adventure-creator.fandom.com/wiki/Showing_Hotspot_icons_with_a_keypress

But I get this error which makes no sense to me, how do I fix this?
https://imgbox.com/zdMzenFr

I've made sure to set 'Display Hotspot Icons' to 'Via Script Only' in the AC Settings Manager.

Comments

  • edited March 2023

    Okay so I understand now that the input error is in line 35 of the script, where it says:

    if (!KickStarter.stateHandler.IsInGameplay() || Input.GetButtonUp("HighlightAll"))

    So do I need to change 'GetButtonUp'? I tried replacing this with Space (which is the input button I've set up), but it all results in my game not being able to start due to a compiling error.

  • The script relies on Unity's Input Manager - not Input System. The input needs to be defined in "Project Settings -> Input".

    I've updated the script to make it universal, so that it can work with Input System. However, you will need to rely on AC's Input System integration package, which can be found on the Downloads page.

  • edited March 2023

    I'll try something and return with an update

  • If I use Unity's Input Manager instead of Input System, then I won't need AC's Input System Integration Package, correct?

  • I started over, now only using Unity's Input Manager.
    I get no errors, but it also doesn't do anything when pressing spacebar.
    Is the script supposed to be greyed out like that, like it isn't active? (Sorry if this should be common knowledge, this is the first time I'm using scripts)

    https://imgbox.com/jsyQg5jq

  • Yes, the screenshots look fine.

    What of the Hotspots, though? Do they each have Highlight components attached, and were their icons showing up normally before adding the script and setting Display Hotspot Icons to Only When Highlighting?

    You mentioned making changes to the script - have you reverted back to the one from the wiki?

  • So I've rolled back to a version before I tried implementing the script.
    Here I only had my hotspots display its name when mousing over. It looks like this:
    https://imgbox.com/8CrbcaSO

    If I then set Display Hotspot Icons to 'Only When Highlighting' and attach the Highlight component to the hotspot and to the sprite, it still just displays the name of the hotspot when mousing over. Like this:
    https://imgbox.com/jNrrjzWq

    I tried the different Display Hotspot Icon options, and I can only get it to show the texture by chosing 'Always'.

    And yes, I made sure the script is the original from the wiki, just double checked.

  • We'll need to get the icons showing while highlighting, without the script, first.

    The Highlight component needs to be attached to the same GameObject as the sprite. If your Hotspot and Sprite Renderer are on separate GameObjects, remove the Highlight on the Hotspot component, and make sure the Hotspot's Object to highlight component is set to the Highlight component attached to the sprite.

  • Thanks Chris, that did the trick to make it glow. Afterwards I added the script to the gameobject containing the sprite renderer and now hitting space works!
    Until now I've made all hotspots on separate gameobjects from my sprite renderers, I never thought of combining them. Is it better practice to combine, any thoughts?

  • On a typical adventure game, the overhead of having a separate GameObject is pretty low, so personal prefence is a main factor.

    I'd personally go with a single object, since it's generally easier to deal with fewer objects. Also, if you want to remove a Hotspot at runtime, you can just teleport the whole thing off-screen in a single Action.

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.