Forum rules - please read before posting.

Instantiated GameObjects for ActionLists never go away

Hi again,

I have a menu that consists of a few Toggles. All of those Toggles are part of a Toggle Group, and the Toggle Group has "Allow Switch Off" enabled. Each menu entry is of type "Variable", has "User can change value?" and an "ActionList on click", let's call it "MyActionToTake".

When I play my game:

  1. I press on a toggle and everything works nicely
  2. I press on the same toggle and everything continues to work
  3. I press another toggle, everything is fine

However, if I do this instead:

  1. I press on a toggle and everything works nicely
  2. I press on a DIFFERENT toggle

...makes everything work as it should, but a new GameObject appears on my hierarchy called "MyActionToTake" with my "MyActionToTake" ActionList inside. This GameObject will never go away until I change scenes, and if I continue pressing other toggles in the same way more GameObjects will appear.

My ActionList is checking variables (the ones set by those toggles menu entries) and showing/hiding other AC menus (but not the one that's triggering all this).

My AC version is 1.70.2 and Unity is 2019.4.2f1.

Thanks in advance!

Comments

  • What are the default state of the toggles? Seems like the difference in the two tests is that the first sees you revert the first toggle back to its original state, no?

    How long should "MyActionToTake" last? Should it only process over Actions over a single-frame, or persist over a period ot time? Does the Menu pause the game?

    Let's see screens of the ActionList's properties, too. I'll attempt a recreation.

  • Thanks for the quick response!

    The ActionList is basically checking the variables from the toggles and showing one menu or another, so it runs on a single keyframe, although I have it set to "Run on the background" to avoid pausing the game and having stuff flicker.

    I've found something as well. If I change the UI Toggle "Navigation" to "None" (instead of the default "Automatic"):

    1. The toggle graphic only stays as long as I click the button and will revert back to the default graphic state as soon as I depress it
    2. The behaviour itself (toggling some AC variables) seems to continue to work, so I guess AC is taking care of toggling the variable itself, irrespective of the value of the UI Toggles themselves
    3. The ActionList GameObject is created on every toggle press now.

    The properties of the ActionList are just setting it to "Run in Background" as mentioned, without anything else checked. If you mean the whole ActionList with its actions I can provide it, of course.

    Thanks again!

  • Oh, forgot about the first question. Default state of the toggles is all off, but not sure it matters. And sure, the difference is that in the first case, I manually change the toggle state, and in the others, the toggle is being deselected automatically by Unity when selecting another.

  • Recreated the original issue. I'll work on a fix for the next update, but you can get around it in the meantime by checking Can run multiple instances? in the ActionList asset's Inspector.

    I cannot recreate the second issue, though. Unity UI's Navigation property isn't read by AC and shouldn't factor in. Are you using the mouse for control?

  • Thanks, I'll try the temporary fix soon.

    About the second issue, I guess it's the same, but when the navigation mode is None Unity is not really selecting anything (EventSystem.SetSelectedGameObject is not being called in that instance) and I'm assuming that changes behavior somewhat. And I'm using the mouse, but with AC in "Touch Screen" mode, plus "Choose Interaction then Hotspot".

    In any case, it's probably not important as long as the original issue is fixed, the second one will probably be gone as well.

    Thanks again!

  • Touch Screen isn't meant for mouse input - revert back to Mouse And Keyboard if you're relying on the mouse.

    Though, you can also supply a custom Event System that's just the default one Unity generates made into a prefab. AC's own Event System makes a few assumptions about input method based on settings that may be affecting it.

  • My game is meant for touch screens, I mean I'm using the mouse while testing this on the editor, sorry :).

    In any case, your temporary fix worked as expected, and I don't see any more GameObjects being created. I'll wait for the proper fix and update if possible when you do a release with it.

    Thanks again!

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.