Forum rules - please read before posting.

Bug When Loading Action List from Asset File and Saving to Prefab

Hi!
First, I'm unable to add an Action List component and change the type to Asset File because this happens:
Second, I can't seem to save the Action Lists to a prefab. Is this normal?

Thanks!

Comments

  • BTW, I'm using Unity 2020.1.2f1 on a Windows 10 os.

  • I'm using Unity 2020.1.2f1 on a Windows 10 os.

    And what version of AC?

    I'm unable to add an Action List component and change the type to Asset File because this happens

    Are you getting any error messages in the Console?

    Try opening up ActionListEditor.cs, and replace line 51:

    if (_target.assetFile.NumParameters > 0)
    

    with:

    if (_target.assetFile.NumParameters > 0)
    

    I can't seem to save the Action Lists to a prefab. Is this normal?

    Yes - you need to rely on ActionList assets instead if you want Actions to survive outside a scene.

    A tutorial on working with assets in prefab-based workflows can be found here.

  • edited August 2020

    Thanks for the prompt response! I'm using AC 1.71.8
    Changing the line was not successful ( I think you forgot to change the code on the second snippet. )
    Here's the error code I'm getting:
    NullReferenceException: Object reference not set to an instance of an object AC.ActionListEditor.ShowPropertiesGUI (AC.ActionList _target) (at Assets/Plugins/AdventureCreator/Scripts/ActionList/Editor/ActionListEditor.cs:51) AC.ActionListEditor.OnInspectorGUI () (at Assets/Plugins/AdventureCreator/Scripts/ActionList/Editor/ActionListEditor.cs:36) UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <701f6580abad44cfb237a543dcd0d94b>:0) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

    I'll be sure to watch the video, thank you!

  • I think you forgot to change the code on the second snippet.

    Sorry about that! That should have been:

    if (_target.assetFile && _target.assetFile.NumParameters > 0)
    
  • Thank you, worked like a charm!
    I have another issue, if you could please help me: is there a way to Set the parameters on an object with an action list that is neither a trigger or a hostspot? I'm using Playmaker to call Interact() methods on two Action Lists and they have parameters referencing the prefab game object, but I can't get the correct game object since I can't set them when the prefab is instantiated.

  • Thank you, worked like a charm!
    I have another issue, if you could please help me: is there a way to Set the parameters on an object with an action list that is neither a trigger or a hostspot? I'm using Playmaker to call Interact() methods on two Action Lists and they have parameters referencing the prefab game object, but I can't get the correct game object since I can't set them when the prefab is instantiated.

  • edited September 2020

    You can set an ActionList parameters by:

    1) Using the ActionList: Run Action to set them in bulk. Note that this Action can be used to set parameter values without actually running the ActionList itself
    2) Using the ActionList: Set parameter Action to set an individual parameter's value
    3) Through code. You can get and set an ActionList's parameter values with:

    ActionParameter myParameter = myActionList.GetParameter ("MyParameterName");
    myParameter.gameObject = myGameObjectValue;
    

    I think I'd need a bit of context to help properly - can you share screens to illustrate the situation? If not a Trigger / Interaction type, what type exactly is it?

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.