Forum rules - please read before posting.

State of hotspot/object visibility on start

Hello Chris,

We are making our first game on Unity with Adventure Creator and I have faced with one issue:

Component Remember Hotspot / Remember Visibility is not working correctly when I choose

Hotspot state on start = off
or
Visibility on start = off

It is not turning hotspot/visibility to off on start of the scene (no matter if I load the scene or enter to the scene).

I assume I am doing something wrong and something else should be done to make this switch work?

Could you please advise.

Best regards,
Pavel

!

Comments

  • Welcome to the community, @Triomatica.

    Please include your AC and Unity version numbers when reporting issues, as I'll need them to help diagnose problems.

    You mention two Remember components - are you attaching both to the same object, or are you having trouble with both of these on separate objects?

    (no matter if I load the scene or enter to the scene).

    To be clear: the "state on start" field will only affect the object's state when the game begins, not each time the scene begins. If you enable the Hotspot during gameplay, it then should remain enabled when re-entering the scene - as this is the purpose of the Remember Hotspot component.

    If you wish to disable a Hotspot every time the scene begins, regardless of it's earlier state, remove the component and set the GameObject's layer to Ignore Raycast.

  • Thank you for the answer!

    AC version is 1.73.6
    Unity version is 2020.3.6f1

    You mention two Remember components - are you attaching both to the same object, or are you having trouble with both of these on separate objects?

    I am attaching those components to different objects and I am having trouble with both of them on separate objects.

    To be clear: the "state on start" field will only affect the object's state when the game begins, not each time the scene begins. If you enable the Hotspot during gameplay, it then should remain enabled when re-entering the scene - as this is the purpose of the Remember Hotspot component.

    Yes, it is clear. But my issue is that if "state on start" is set to "off" it is not affecting state of the object on start of the game, it is still "on".

    Remembering of objects state with Remember component is working properly, but only if it was enabled initially, then if I disable it during gameplay it remains disabled after re-entering the scene.

    But if I need the object to be disabled initially on game start - it is not working.

    If you wish to disable a Hotspot every time the scene begins, regardless of it's earlier state, remove the component and set the GameObject's layer to Ignore Raycast.

    No, it was not my goal. I need some objects to be enabled and some disabled on start. During the gameplay objects are enabled and disabled according to the logic schemes and then I need to keep their state when player leaves and re-enters the scene in any moment of the gameplay.

    Also I have another question. Trying to solve abovementioned issue I have tried another way of organizing game screens. Initially I made each playscreen in separate scene and switched scene with Scene:Switch command. But I tried to make several playscreens (with separate camera for each playscreen) in one scene and switching screens with Camera:Switch and Object:Teleport for the Player. I am not sure what is the "right" way to organize this. Please advise.

  • if I disable it during gameplay it remains disabled after re-entering the scene

    Disabled, as in using an AC Action to disable it, or disabling the GameObject itself in its Inspector?

    If you're using the Remember components and AC Actions, it should just work. The workflow you're describing sounds correct, so it may be down to some key detail that hasn't been described here. If you can share screenshots of the object and logic used, I can try to spot the problem.

    But my issue is that if "state on start" is set to "off" it is not affecting state of the object on start of the game, it is still "on".

    In the case of a Hotspot, you should be seeing a box in its Inspector with the words "Current state: OFF" when the game begins, as well as the GameObject itself being placed on the Ignore Raycast layer. Check that there's nothing else involved that may affect it, such as a parent component or animation setting.

    I am not sure what is the "right" way to organize this. Please advise.

    It should be down to your personal preference. Both approaches are valid, though generally it's more manageable to divide your areas into separate scenes. It should not be necessary to resort to this technique simply to solve the above problem - but we'll get to the bottom of it.

  • Disabled, as in using an AC Action to disable it, or disabling the GameObject itself in its Inspector?

    Disabled with AC Action Hotspot:Enable or disable

    If you're using the Remember components and AC Actions, it should just work. The workflow you're describing sounds correct, so it may be down to some key detail that hasn't been described here. If you can share screenshots of the object and logic used, I can try to spot the problem.

    Disabling hotspot in On Start action list with Hotspot:Enable or disable is working, but this is not what I need because it disabling this hotspot every time scene is started.
    https://www.dropbox.com/s/88klxgh1uvs124q/works.png

    I assume "state on start" switch should work fine for my needs, but it is not working. Hotspot is still "on" on start.
    https://www.dropbox.com/s/vidtuncrlblutbj/notworking.png

    In the case of a Hotspot, you should be seeing a box in its Inspector with the words "Current state: OFF" when the game begins, as well as the GameObject itself being placed on the Ignore Raycast layer.

    Yes, I see "Current state: OFF" sign only when disabling hotspot in On Start action list with Hotspot:Enable or disable. When disabling it with "state on start" - do not see "Current state: OFF".

    Check that there's nothing else involved that may affect it, such as a parent component or animation setting.

    This is test scene without any other parent or child objects to hotspot and without any animations.

  • It's not an issue I can recreate from these details alone - a fresh scene with a Hotspot, given a Remember Hotpot with the same settings does not cause such an issue for me.

    PM me your scene file and Manager assets, and I'll take a look directly.

  • It's not an issue I can recreate from these details alone - a fresh scene with a Hotspot, given a Remember Hotpot with the same settings does not cause such an issue for me.

    Issue is solved. Problem was in Project Settings - Editor - Enter Play Mode Settings

    These are settings I had and this caused the issue
    https://www.dropbox.com/s/c8pzdo1jqephgwl/wrong.png?dl=0

    Now all works well
    https://www.dropbox.com/s/fr18i5x5sa0wa16/right.png?dl=0

    Thank you for your help!

  • @Triomatica I had the same issue as well, thanks for sharing the solution!

  • Back here looking for a solution again because I ran into the same problem again :D
    The images for the correct settings above have been deleted, so the solution is to disable the "Enter Play Mode" checkmark in the Editor, Project settings.

    I had only enabled that as entering play mode takes a lot of time in newer versions of Unity and apparently that's the solution to fix that XD oh well.

  • Unfortunately I don`t remember which checkmarks were enabled back then, but for now I have enabled Enter Play Mode Options and Reload Scene checkmarks

  • This issue should now be resolved in v1.75.4.

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.