Forum rules - please read before posting.

Exception after copying ActionList Asset and unticking "Use Parameters"

Hey Chris,

I think I've found a bug. I copied an ActionList asset that was using a parameter and in the copy I unticked "Use Parameters" without removing the parameter and it produces this null reference exception:

NullReferenceException: Object reference not set to an instance of an object
AC.ActionRunActionList.AssignValues (System.Collections.Generic.List`1[T] parameters) (at Assets/AdventureCreator/Scripts/Actions/ActionRunActionList.cs:117)
AC.ActionList+<RunAction>d__47.MoveNext () (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:449)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <f7237cf7abef49bfbb552d7eb076e422>:0)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
AC.ActionList:ProcessAction(Int32) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:412)
AC.RuntimeActionList:BeginActionList(Int32, Boolean) (at Assets/AdventureCreator/Scripts/ActionList/RuntimeActionList.cs:181)
AC.ActionList:Interact(Int32, Boolean) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:283)
AC.RuntimeActionList:DownloadActions(ActionListAsset, Conversation, Int32, Boolean, Boolean, Boolean) (at Assets/AdventureCreator/Scripts/ActionList/RuntimeActionList.cs:136)
AC.AdvGame:RunActionListAsset(ActionListAsset, Conversation, Int32, Boolean, Boolean) (at Assets/AdventureCreator/Scripts/Static/AdvGame.cs:242)
AC.AdvGame:RunActionListAsset(ActionListAsset, Int32, Boolean) (at Assets/AdventureCreator/Scripts/Static/AdvGame.cs:201)
AC.ActionRunActionList:Run() (at Assets/AdventureCreator/Scripts/Actions/ActionRunActionList.cs:208)
AC.<RunAction>d__47:MoveNext() (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:470)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
AC.ActionList:ProcessAction(Int32) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:412)
AC.ActionList:BeginActionList(Int32, Boolean) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:382)
AC.ActionList:Interact(Int32, Boolean) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:283)
AC.ActionList:Interact() (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:246)
AC.Conversation:RunOption(ButtonDialog) (at Assets/AdventureCreator/Scripts/Logic/Conversation.cs:791)
AC.<>c__DisplayClass20_0:<RunOption>b__0() (at Assets/AdventureCreator/Scripts/Logic/Conversation.cs:286)
AC.<DelayConversation>d__166:MoveNext() (at Assets/AdventureCreator/Scripts/Controls/PlayerInput.cs:2744)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

After ticking "Use Parameters" again, the ActionList asset runs just fine (even though it has no parameters defined anymore). So I suppose this might be more of an editor problem.

Anyway, I just wanted to give you a heads-up on this.

Comments

  • edited July 2024

    More info on the situation:

    The ActionList asset in question contained only an ActionList:Run node that runs another ActionList asset with some parameters. I removed the node and added it again. Now it doesn't produce the error, even though "Use Parameters" is unticked.

    Here are the steps that led to the problem:

    1. Created ActionList asset that runs another ActionList with "Use Parameters" ticked and one Object parameter.
    2. Copied the ActionList and in the ActionList:Run node, I just changed the ActionList asset that should be run. This new ActionList reference did not require the Object parameter (and I have a feeling that this is were the actual problem lies).
    3. Unticked "Use Parameters" on the copied asset without removing the parameter first (but I don't think that this is the problem)

    I suppose that there is still a reference to the parameter somewhere (when debugging, localParameters still had the Object parameter reference, although the copy of the ActionList asset wasn't using it anymore).

  • Thanks for the details. Though in addition: what's your AC version?

  • Sure :) Sorry, I always forget to add the version.... I'm on 1.81.4

  • Thanks.

    To fix, open up the ActionRunActionList script, and replace line 117:

    if (localParameters != null && localParameters.Count > 0)
    

    with:

    if (localParameters != null && localParameters.Count > 0 && parameters != null)
    
  • Thank you Chris! :)

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.