Forum rules - please read before posting.

Hotspots show up when playtesting, but not after Build & Run

Hello,

I'm about a month into learning Unity & working on a very simple interactive fiction / point-and-click thing in Adventure Creator. I've encountered a very confusing issue where my hotspots, for some reason, do not seem to activate or function at all after Building an .exe of the game. However, confusingly, everything works fine when playtesting in the Unity Editor.

Video example: https://drive.google.com/file/d/1xXgE4AX_AKYuDV0DKkg0nAPL5QJY0OM3/view?usp=sharing

As you can see clicking on the "Aquarium" hotspot should change scenes, but it isn't working currently after Building.

One lead I have is that creating a new hotspot and then Building seems to work, but once I add the "Remember Hotspot" component, a little blue floppy disc icon pops up in the hierarchy and then the hotspot no longer works after Building (but still works in the editor - weird). After adding "Remember Hotspot" even once, the hotspot no longer works after Building even if I remove the component. The tutorials have indicated that "Remember Hotspot" is important for returning to/from different scenes, so I'm hoping I don't have to forego it altogether for some reason.

I'm using Unity Editor version 2020.3.33f1 and AC version 1.75.3.

Thanks in advance for any help you might be able to offer! I appreciate it.

Comments

  • edited May 2022

    To clarify: the Remember Hotspot component is used to record a Hotspot's on/off state in save data. If you're not changing its state at runtime, you don't need to add it.

    In the cases when you do, however, there'll be a Hotspot state on start field at the top where you can set its default state. If this is set to On, then the Hotspot should be clickable by default.

    The Hotspot in your Hierarchy doesn't have the save icon, though. If new Hotspots are working, check that your Settings Manger's Camera perspective setting matches the type of Collider attached to your Hotspots. For 2D games, Hotspots need to have 2D Colliders - e.g. Box Collider 2D / Polygon Collider 2D. AC will add the correct components to Hotspots made in the Scene Manager, but only provided that the "Camera perspective" has been set beforehand.

    Share screenshots of a Hotspot Inspector that works vs one that doesn't, as well as your Settings Manager, if the issue persists.

  • edited May 2022

    Thank you for the quick response!

    I have 'Hotspot State on Start' set to ON, and I am using both a 2D camera perspective and 2D colliders (box collider 2D for one hotspot, and circle collider 2D for another). The reason the save icon doesn't appear in the video is because I had removed the "Remember Hotspot" component before recording.

    Here are screenshots of my Settings Manager:
    1. https://drive.google.com/file/d/1t_VhCrHDG3vRiXhmzQ2oNfpHufzqvwfc/view?usp=sharing
    2. https://drive.google.com/file/d/1JHJovKPOGW97D5x78P7sDhCsCTY_QB8L/view?usp=sharing

    And here is a screenshot of the Hotbox inspector panel. This one is working when playtesting in the editor, but not after Building the game:
    https://drive.google.com/file/d/1fpK0hXS-zzFz_kJNiqURKLuLSPwkh6xK/view?usp=sharing

    I actually can't get even a brand new one to work at all today, whether or not the "Remember Hotspot" component is added. Edit: I managed to get a brand new hotspot to work after Building. Here's what the inspector looks like:
    https://drive.google.com/file/d/1MAFjedkaOX7mBV3kyUdXad2CFyuwWwaW/view?usp=sharing

    I haven't been able to figure out why this one for example works after Building but the others don't. I'm sure there's something consistently going wrong but can't tell what it is yet.

    Is there a known issue where AC game elements work in the editor but not after Building? It's a little concerning knowing it's possible for things to work flawlessly when playtesting but break once the game is built.

    Thank you so much again for the help here!

  • Couple of new discoveries/details:

    • Strangely, it seems like creating a new Hotspot with the same linked interaction causes both the new and old ones to work when Building.
    • If I delete the old one after creating a new one in this way, the new one no longer works.
    • Changing which Scenes are loaded in the Hierarchy sometimes causes the hotspots to stop working in the Editor, in addition to when Building.

    Not sure if this info helps, but I will continue testing stuff... Thanks again.

  • Another clue... I ran both the playtest and build with the 'Show AC Status Box' debugger active and noticed that the playtest lists "Subscenes" (the scenes accessed through the problematic hotspots) whereas the Build does not. I'm wondering if the other scenes are not loading properly in the Build, which could be why the hotspots don't activate?

  • If this is subscene-related: how is it that you're managing your scenes at runtime? Are all your scenes added to Unity's Build Settings?

    Particularly for 2D games, it's generally more manageable to limit your open scenes to just one at a time - with the addition of subscenes being reserved for complex situations.

    Are you relying on "Scene: Add or remove" Actions rather than "Scene: Switch"?

    It would be worth checking Unity's Player Log for potential warning messages about scenes not being loaded.

  • Hey Chris, thanks for the response.

    I'm not totally sure whether it's subscene-related, but I did notice in the debugger that the subscenes associated with the hotspot interactions are loaded while playtesting in the editor, but not after a Build.

    All my scenes are loaded to the Build Settings. I have three of them so far. When playtesting I can easily transition between them using the Hotspots and interactions I've set up. After a Build, it's like the hotspots aren't there at all.

    The ActionList for the interactions use "Scene: Switch". I'm not preloading or opening unused scenes at all, that I know of.

    I made a Development Build and collected a Player Log. I'm not totally sure what to make of it. A couple lines mention "AC.MultiSceneChecker:Awake ()" but I don't see any errors or warnings that indicate what could be going wrong. Here is a link to the Player Log: https://drive.google.com/file/d/1Cx_IH5OGwPHg2j351NgC5OcfyAdA7l1X/view?usp=sharing

    I still find it quite odd that:
    (1) The hotspots work fine in the Editor, but not in a Build
    (2) The hotspots work in a Build when there are two of them linked to the same interaction/scene switch, but not when there's only one (I should only need one, obviously).

    Thanks again for the continued help....This is really stumping me!

  • OK, seems I have found a fix... It was apparently an issue with sorting layers? I changed the z-position of the hotspots from 0 to 1 (leaving them in the Default hotspot layer) and they are now registering as expected in a build.

    Still no idea why it was working in the editor and not when built out...maybe the playtest and the .exe handle cameras & the sorting map differently? Not sure, but at least it seems fixed for now!

  • The sorting may be a knock-on effect rather than a cause. A Hotspot sprite hidden behind another sprite will still be interactive, unless the sprite above it also has a collider - which typically isn't necessary for background sprites.

    It may be more a case of the Hotspot's z-position relative to that of the camera, which will need to be "further back" than the Hotspot in order to detect it.

    Still, it is odd that you'd have a difference between builds and the Editor - AC shouldn't be treating Hotspots differently at these times. I don't want to pass the buck prematurely, but it may be a Unity-related quirk.

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.