Forum rules - please read before posting.

actionlist\interaction messed up in editor

Hi there,

First I want to say I'm using AC for the last 6 months
and it amazing!! good job chris! I've managed to make a full demo of 1 hour
with many features just by reading your answers in the forum.
I'm nearly releasing the demo, but in the last week a nasty bug occur and I'm helpless.

When I open actionlist asset or interaction that using custom actionlist I wrote
(the code in the next comments, too long for this post)
it is messed up in the editor https://imgur.com/N4J12K3
I'm using this custom actionlist for a while and it works fine.
If I create a new one it works without a problem, this is how it looks when it works:
https://imgur.com/ezMxJje
Only actionlists\interactions which use it before are messed up.
here is the error I get in the log:
https://imgur.com/O0voBfl

I was using unity collab and since this bug the sync doesn't work anymore, and I can't rolled back.
here is the error I get:
https://imgur.com/gallery/hHfsuhP

I tried to disabled this custom actionlist, and it's still not working.
I'm calling that custom in many places in the project
so it will be a nightmare to create those actionlist\interaction from scartch.

AC version: 1.70.4

Unity version: 2019.3.11f1

I'm also using Dialogue system for unity, version: 2.2.6

PS
I tried to upgrade AC to new version
but I saw errors getting from Dialogue system for unity (even with their new version)
so I rolled backed both. maybe the roll back make the problem, but it's just a guess.

Thanks in advance,
Yakir

Comments

  • `
    [System.Serializable]
    public enum OverrideOption
    {
    Full,
    StartTalk,
    EndTalk
    }

    [System.Serializable]
    public class AnimateOverride : ActionRunActionList
    {
        public AnimateOverride()
        {
            this.isDisplayed = true;
            category = ActionCategory.Character;
            title = "Override custom animation";
            description = "This is a blank Action template.";
        }
    
        public override float Run()
        {
    
            if (!isRunning)
            {
                ActionListAsset actionList_new = null;
                switch (option)
                {
                    case OverrideOption.Full:
                        actionList_new = Full();
                        break;
                    case OverrideOption.StartTalk:
                        actionList_new = StartTalk();
                        break;
                    case OverrideOption.EndTalk:
                        actionList_new = EndTalk();
                        break;
                }
    
                if (actionList_new != null)
                {
                    listSource = ListSource.AssetFile;
                    invActionList = actionList_new;
                    willWait = true;
                    runFromStart = true;
                }
            }
    
            if (endAction == ResultAction.Skip)
                runInParallel = true;
    
            return base.Run();
        }
    
    public ActionListAsset EndTalk()
        {
            ActionCharAnim action1 = CreateInstance<ActionCharAnim>();
            action1.isPlayer = true;
            action1.method = ActionCharAnim.AnimMethodChar.PlayCustom;
            action1.clip2D = clipNameEnd;
            action1.idleAfter = false;
            action1.willWait = true;
    
    
            ActionCharAnim action2 = ActionCharAnim.CreateNew_SpritesUnity_SetStandard(AC.KickStarter.player, AnimStandard.Idle, idle);
            ActionCharAnim action3 = ActionCharAnim.CreateNew_SpritesUnity_SetStandard(AC.KickStarter.player, AnimStandard.Talk, talk);
    
            ActionCharAnim action4 = ActionCharAnim.CreateNew_SpritesUnity_ResetToIdle(AC.KickStarter.player, true);
            ActionCharRender action5 = ActionCharRender.CreateNew_Sprites(AC.KickStarter.player,
                 (changeSortingOrder) ? RenderLock.Release : RenderLock.NoChange, 0, RenderLock.Release, 75,
                RenderLock.NoChange, CharDirection.Down,
                RenderLock.NoChange, AC.KickStarter.sceneSettings.sortingMap);
    
            ActionCharFaceDirection action6 = ActionCharFaceDirection.CreateNew(AC.KickStarter.player, curr_direction);
    
            ActionListAsset actionList = CreateInstance<ActionListAsset>();
            actionList.actions.Add(action1);
            actionList.actions.Add(action2);
            actionList.actions.Add(action3);
            actionList.actions.Add(action4);
            actionList.actions.Add(action5);
            actionList.actions.Add(action6);
            actionList.actionListType = ActionListType.PauseGameplay;
    
            return actionList;
        }
        public ActionListAsset StartTalk()
        {
            ActionListAsset actionList = CreateInstance<ActionListAsset>();
            ActionCharFaceDirection action1 = ActionCharFaceDirection.CreateNew(AC.KickStarter.player, direction);
    
            curr_direction = direction;
    
            ActionCharRender action2 = ActionCharRender.CreateNew_Sprites(AC.KickStarter.player,
             (changeSortingOrder) ? RenderLock.Set : RenderLock.NoChange, sortingOrder, RenderLock.Set, scale,
            RenderLock.NoChange, CharDirection.Down,
            RenderLock.NoChange, AC.KickStarter.sceneSettings.sortingMap);
    
            ActionCharAnim action3 = ActionCharAnim.CreateNew_SpritesUnity_SetStandard(AC.KickStarter.player, AnimStandard.Idle, idleNew);
            ActionCharAnim action4 = ActionCharAnim.CreateNew_SpritesUnity_SetStandard(AC.KickStarter.player, AnimStandard.Talk, talkNew);
    
            ActionCharAnim action5 = CreateInstance<ActionCharAnim>();
            action5.isPlayer = true;
            action5.method = ActionCharAnim.AnimMethodChar.PlayCustom;
            action5.clip2D = clipName;
            action5.idleAfter = false;
            action5.willWait = true;
    
            actionList.actions.Add(action1);
            actionList.actions.Add(action2);
            actionList.actions.Add(action3);
            actionList.actions.Add(action4);
            if (clipName != null)
                actionList.actions.Add(action5);
            actionList.actionListType = ActionListType.PauseGameplay;
    
            return actionList;
        }
    
    
        public ActionListAsset Full()
        {
            ActionListAsset actionList = CreateInstance<ActionListAsset>();
            ActionCharFaceDirection action1 = ActionCharFaceDirection.CreateNew(AC.KickStarter.player, direction);
            action1.willWait = true;
    
            ActionCharRender action2 = ActionCharRender.CreateNew_Sprites(AC.KickStarter.player,
             (changeSortingOrder) ? RenderLock.Set : RenderLock.NoChange, sortingOrder, RenderLock.Set, scale,
            RenderLock.NoChange, CharDirection.Down,
            RenderLock.NoChange, null);
            action2.willWait = true;
    
            ActionCharAnim action3 = ActionCharAnim.CreateNew_SpritesUnity_PlayCustom(
                AC.KickStarter.player, clipName, false,0,0,true, false);
    
            ActionCharAnim action4 = ActionCharAnim.CreateNew_SpritesUnity_ResetToIdle(AC.KickStarter.player, true);
            action4.willWait = true;
    
            ActionCharRender action5 = ActionCharRender.CreateNew_Sprites(AC.KickStarter.player,
                (changeSortingOrder) ? RenderLock.Release : RenderLock.NoChange, 0, RenderLock.Release, 0,
                RenderLock.NoChange, CharDirection.Down,
                RenderLock.NoChange, null);
            action5.willWait = true;
    
            actionList.actions.Add(action1);
            actionList.actions.Add(action2);
            actionList.actions.Add(action3);
            actionList.actions.Add(action4);
            actionList.actions.Add(action5);
            actionList.actionListType = ActionListType.PauseGameplay;
    
            return actionList;
        }
    
        public override void Skip ()
        {
             Run ();
        }
    
        public CharDirection direction;
        static CharDirection curr_direction;
        public int scale = 100;
        public int sortingOrder = -1;
        public string clipName = "";
        public string clipNameEnd = "";
        public string idleNew = "";
        public string talkNew = "";
        public string idle = "";
        public string talk = "";
        public bool changeSortingOrder = false;
        public OverrideOption option = OverrideOption.Full;
    

    `

  • `#if UNITY_EDITOR

        public override void ShowGUI(List<ActionParameter> parameters)
        {
    
            option = (OverrideOption)EditorGUILayout.EnumPopup("Option:", option);
            switch (option)
            { 
                case OverrideOption.Full:
                direction = (CharDirection)EditorGUILayout.EnumPopup("Direction:", direction);
                scale = EditorGUILayout.IntField("Scale:", scale);
                    changeSortingOrder = EditorGUILayout.Toggle("Change sorting order?", changeSortingOrder);
                    if (changeSortingOrder)
                        sortingOrder = EditorGUILayout.IntField("Sorting order:", sortingOrder);
                    clipName = EditorGUILayout.TextField("Clip to play:", clipName);
                    break;
                case OverrideOption.StartTalk:
                    direction = (CharDirection)EditorGUILayout.EnumPopup("Direction:", direction);
                    scale = EditorGUILayout.IntField("Scale:", scale);
                    changeSortingOrder = EditorGUILayout.Toggle("Change sorting order?", changeSortingOrder);
                    if (changeSortingOrder)
                        sortingOrder = EditorGUILayout.IntField("Sorting order:", sortingOrder);
                    clipName = EditorGUILayout.TextField("Clip to start:", clipName);
                    idleNew = EditorGUILayout.TextField("New idle:", idleNew);
                    talkNew = EditorGUILayout.TextField("New talk:", talkNew);
                    break;
                case OverrideOption.EndTalk:
                    clipNameEnd = EditorGUILayout.TextField("Clip to end:", clipNameEnd);
                    idle = EditorGUILayout.TextField("idle to return:", idle);
                    talk = EditorGUILayout.TextField("talk to return:", talk);
                    changeSortingOrder = EditorGUILayout.Toggle("Sorting order was changed?", changeSortingOrder);
    
    
                    break;
            } 
    
            AfterRunningOption();
        }
        public override string SetLabel ()
        {
            return string.Empty;
        }
    
        #endif
    }
    

    }
    `

  • Welcome to the community, @Adventure4LifeS.

    I suspect this is a case of compounding issues. Your custom Action has some issues, and as a result is causing issues with the ActionList it's in.

    The latest release does a better job of keeping an ActionList "stable" when it has such a broken Action. I'd advise trying again with the update - PixelCrushers are great at helping with any issues related to DialogueSystem and it's AC integration.

    As for the custom Action itself, it looks like you're trying to generate a new ActionList asset through script - each time it's run. This'll cause problems in my experience - particularly since these would be generated at runtime.

    It's possible to generate ActionLists through scripting (and at runtime), but you should typically only do so with scene-based ActionLists - not asset files. Aside from memory/saving issues, asset files also come with the added complexity of having to manually add the Actions to the ActionList asset files, i.e.:

    AssetDatabase.AddObjectToAsset (action, actionListAsset);
    AssetDatabase.ImportAsset (AssetDatabase.GetAssetPath (action));
    

    That said, I'm not quite following your need to have such a custom Action to begin with. From the looks of it, you could get by with a set of three ActionLists (Full, StartTalk, EndTalk), pre-made as asset files, and then change their runtime values as needed using parameters.

  • Thanks for you quick reply, chris.

    I will update both AC and Dialogue system for unity and will let you know
    if issue solved.

  • To be clear: updating AC won't resolve the issue with your custom Action itself, just (hopefully) prevent it causing issues with the rest of the ActionList it's in.

  • edited June 2020

    Yes, it works, now I can see the interaction without broken links :)
    However, I see it removed the custom action entirely from every interaction\actionlist it was called.
    I will do as you suggest and make three actionlist assets instead
    of creating it in runtime, just for safety.
    But for now, since I Iost all the settings I put for each call of the custom action (there are sooo many!)
    There is a workaround to solve the issue? so I can take the parameters and
    then replace each custom action with asset?

  • The Action would have already been lost if they're now not showing - the issue that the latest release fixed was related to "null" Actions causing problems, so it sounds like the Actions were already broken by this point, I'm afraid. Why this occured, though, I cannot say.

    Is the custom Action class itself still listed in the Actions Manager? If so, and you haven't since saved such ActionLists, you may be able to retrieve the Actions if whatever broken code was present is fixed.

    While it wouldn't be ideal (and take a backup first), AC will at least make mention of any null Actions found when you run the Speech Manager's Gather text operation. Though it won't tell you what the missing Actions were set to, you should at least be able to use this feature to at least let you know where in the project they were.

  • edited June 2020

    I already save these actions, so I think no other choice by
    go one by one and put the settings again :(
    Anyway, your suggestion with 'Gather text' will make it
    easy to find all the null actions.

    I start working on what you suggested - actionlist assets for full, start talk and end talk. there is a way to pass pop up variable paramater? I need it for character->face direction (instead of using integer)
    and for character->change rendering->set sprite scale, I don't see it accept parameters
    probably that what led me to go for custom action from the first place.

  • edited June 2020

    I shall look into upgrading this Action with the ability to override the scale with an Integer parameter. Can you share screenshots to show how you mean to override it with a popup variable parameter?

  • edited June 2020

    Screenshot attached.
    https://imgur.com/fW4rLfV
    https://imgur.com/BTP9c4g
    https://imgur.com/PVEpevG

    it will be good for other uses of pop up variable too.
    if the enum CharDirection can be exposed as predefine preset
    then character->direction will accept this parameter.
    (a safe approach that doesn't demends additional checking)

    If it's not possible, then another solution will be to accept any pop up variable
    and character->direction will bound it to its range.

  • My gut feeling is that we'd be getting into territory where things become too complex and disconnected there - with ranges being bound to popup labels that don't necessarily match, and more fields when they'd be rarely used.

    I'll give it some thought, but as an enum is essentially an integer index anyway it should at least be possible to use an integer parmeter to override the direction field.

  • edited June 2020

    Custom actions has their advenatge because of their EnumPopup
    which decrease the odd for user mistakes and easy to use manner
    (no need to think what number '7' means :D )
    but of course I understand your concern. hope it will work out
    and even if not. thanks for the assistant!

  • edited June 2020

    You're welcome to continue with custom Actions, naturally - they're their to help.

    The original issue wasn't with using a custom Action in and of itself - just that the implementation needed a bit of tweaking.

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.