Forum rules - please read before posting.

How do I enable/disable Hotspot from script?

Sorry for my ignorance.
How do I enable/disable Hotspots from script?
Thanks.

Comments

  • Just call their TurnOn / TurnOff functions.
  • edited June 2015
    Sorry, how exactly do I do it? Cause I get:
      error CS0103: The name `MyHotspot' does not exist in the current context

    If I just use this MyHotspot.TurnOff ();
  • edited June 2015
     AC.KickStarter.MyHotspot.TurnOff ();
    Doesn't work either.
  • Ok, I got it working. MyHotspot.TurnOff (); does work now.
    Forgot to define public Hotspot MyHotspot ;

    Thanks :)
  • How do I start an interaction from the script?
  • Call it's Interact() function.

    For what it's worth, I'm planning to release a Script Reference with the next major release of AC.  A tutorial will also be published that covers writing an Interaction entirely through script.
  • Ahhh, that would be super-duper handy, thanks Chris. :)
    For I couldn't find any references in the documentation manual file that comes with AC.
  • I am using Unity 2019.4.6f1 and AC 1.72.4. I happened to run into a situation that, when using the script MyHotspot.TurnOff ();, it works in the Editor but not in a compiled version for Windows (I only tested x64).

    My usage is in a loop:
    for (int i = 0; i < buttonsHotspots.Length; i++) {
    buttonsHotspots [i].TurnOff();
    }

  • There shouldn't be any difference in the Hotspot script's TurnOff function in builds vs editor.

    What's the context surrounding that code? When are you running it, and how are you assigning the buttonsHotspots array?
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.