Forum rules - please read before posting.

Scene switching bug

After returning from one scene to another game freezes. It happens because in
 Assets/AdventureCreator/Scripts/Managers/ActionListAssetManager.cs  method EndAssetList has an endless cycle. Line124

   for (int i=0; i<activeLists.Count; i++)
   {
      if (activeLists[i].IsFor (asset))
      {
         if (_action == null || !activeLists[i].actionList.actions.Contains (_action))
         {
            KickStarter.actionListManager.EndList (activeLists[i]);
            numRemoved ++;
            i=-1;
            if (asset.canRunMultipleInstances && !forceEndAll)
            {
               return numRemoved;
            }
         }
         else if (_action != null) ACDebug.Log (“Left ” + activeLists[i].actionList.gameObject.name + ” alone.“);
      }
   }

It happens because activeLists[i] is not being deleted from activeLists, but variable i rolls back to 0:  i=-1;

Detailed view showed, that ActiveList wasn't deleted because it fails check in
 ActionListManager.cs - PurgeLists() line 615:

if (!KickStarter.actionListAssetManager.activeLists[i].IsNecessary ())
because in currently checking ActiveList  resumeIndices.Length > 0

Maybe this method requires a check?

   public int EndAssetList (ActionListAsset asset, Action _action = null, bool forceEndAll = false)
   {
      int numRemoved = 0;
  
      for (int i=0; i<activeLists.Count; i++)
      {
         if (activeLists[i].IsFor (asset))
         {
            if (_action == null || !activeLists[i].actionList.actions.Contains (_action))
            {
               ActiveList activeList = activeLists[i];
               KickStarter.actionListManager.EndList (activeList);
               if (!activeLists.Contains(activeList))
               {
                  numRemoved++;
                  i = -1;
                
                  if (asset.canRunMultipleInstances && !forceEndAll)
                  {
                     return numRemoved;
                  }
               }
            }
            else if (_action != null) ACDebug.Log (“Left ” + activeLists[i].actionList.gameObject.name + ” alone.“);
         }
      }
  
      return numRemoved;
   }

Comments

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.