UFSM: Finite State Machine

Try recreate States array then recreate generated functions. ( green button to add bp functions)

Thanks for the reply,

Already did both, nothing… I remade the states array, deleted the functions and generated them again.

Did you enable “Debug” checkbox in advanced options (below an “v” arrow) on your FSM asset BP to see if there’s any warnings?

Also, is “Auto Flow FSM” option enabled in project settings?

I hadn’t enabled the “Debug” option, this is what it appears on screen, no warnings on the Message Log though.

fsmDebugMessage.jpg

And yes, I have the “auto Flow” option enabled, everything was working fine until I tried to add a new state and began to broke.

The only state that is running is the Startup State configured in the “FSM” Tab on Class Defaults.

Somewhere in your blueprints you are applying a State that doesn’t exist…
As a result the component is set to a “null state” since it can’t find the one you’re telling it to activate.

Ok, so I gave it a rest to everything (including my brain) because it wasn’t working at all, after a good night’s sleep I started to reorganize everything, I even deleted and recreated the component in the owner object and the states in the FSM object. Now it seems to be working correctly.

Thanks for the help.

EDIT:

I’m having problems again, now I can see some warnings on the message log:


{FSM}:: 'Set State' named [None]: State ID doesn't exist. -->  FSM: Set State: [Function /Script/UFSM.StateMachineComponent:SetState at (maquinaEstados-nacho_C /Game/maps/UEDPIE_0_start.start:PersistentLevel.nacho_C_0.maquinaEstados-nacho)]
{FSM}:: 'Set State' named [saltar]: State ID doesn't exist. -->  FSM: Set State: [Function /Script/UFSM.StateMachineComponent:SetState at (maquinaEstados-nacho_C /Game/maps/UEDPIE_0_start.start:PersistentLevel.nacho_C_0.maquinaEstados-nacho)]


I already double checked the state names, for some reason it’s being unable to set an existent state.

I already validated the first one, the [None], it was a mistake on my behalf. But the other one, [saltar], is not being found and it exists (doubled checked)

What can I do?

I have this states array:

fsmError01.jpg

The configuration as pictured above will throw a warning immediately since it can’t detect the “saltar” state. After I did that, all states now are NULL, before that, “idle” and “correr” were working fine.

I tried to change the state by using id and that didn’t work either, it’s like the state doesn’t exist regardless of the array contents.

Is there a way to reset the states besides deleting the array and creating it again? I’ve done that several times and doesn’t work.

Are you sure you’re using case sensitive state names?
“Saltar” and “saltar” are two different things.

Yes, I’m aware of that, I’m sure everything is lowercase.

Besides, as I described, I also tried with states IDs, and that’ didn’t work either.

There’s something that I should note, I don’t know if it’s important to this case: I have two FSM classes, one inheriting from the other. At first, I had the first two states (idle and correr) in the base class. But later I deleted the array on both of them and recreated all the states in the child class.

I recreated the two whole classes and found the same problem:


{FSM}:: 'Set State' named [rollo]: State ID doesn't exist. -->  FSM: Set State: [Function /Script/UFSM.StateMachineComponent:SetState at (maquinaEstados-nacho_C /Game/maps/UEDPIE_0_start.start:PersistentLevel.nacho_C_0.maquinaEstados-nacho)]

And this is my array, as you can see, I have a “rollo” state, in lowercase:

The other states are working fine after I made the two classes from scratch, this is the graph tree of the current states:

If you can migrate the Blueprint to a blank project and send me a link, I can take a look tomorrow morning.
Can’t be a big zip file tho because I have only 30 minutes free to check it out before leaving tomorrow.

Seems like you try somewhere to set states before any State object is created.
I can only be sure looking through bp graphs.


Btw, did you create the array in the asset or just in instances of Fsm Component attached to something?!

Thank you!

Here goes, had to delete some references, the variables were updated from the owner class but I had to delete that because it needs a more complicated environment, if you need the character class that is updating the variables I can see what can I do:

https://www.dropbox.com/s/4et75y1ymrxty28/fsmProblem.zip?dl=1

I created the array inside the asset (one of them, I have two FSM objects, one inherits from the other, the array is in the child)

I guess is better avoid this kind of setup.
Btw, your problem is something else somewhere in your Blueprints.

I executed the project in Unreal 4.18.3 and the plugin is working correctly, everything worked here… I set “rollo” state and it worked just fine:



PIE: Play in editor start time for /Temp/UEDPIE_0_Untitled_1 0.565
FSMs: [maquinaEstados-nacho]: [Exit]---------->(rollo)
PIE: Exit: ]---------->(rollo) at (maquinaEstados-nacho_C /Temp/UEDPIE_0_Untitled_1.Untitled_1:PersistentLevel.Character_Blueprint.maquinaEstados-nacho)
FSMs: [maquinaEstados-nacho]: [Enter]---------->(correr)
PIE: Enter: ]---------->(correr) at (maquinaEstados-nacho_C /Temp/UEDPIE_0_Untitled_1.Untitled_1:PersistentLevel.Character_Blueprint.maquinaEstados-nacho)
FSMs: [maquinaEstados-nacho]: [Exit]---------->(correr)
PIE: Exit: ]---------->(correr) at (maquinaEstados-nacho_C /Temp/UEDPIE_0_Untitled_1.Untitled_1:PersistentLevel.Character_Blueprint.maquinaEstados-nacho)
FSMs: [maquinaEstados-nacho]: [Enter]---------->(idle)
PIE: Enter: ]---------->(idle) at (maquinaEstados-nacho_C /Temp/UEDPIE_0_Untitled_1.Untitled_1:PersistentLevel.Character_Blueprint.maquinaEstados-nacho)


Something in your setup is calling “Set State” to your Fsm Component while no State object have been created yet… then you see the error you report about “State doesn’t exist”.

Fsm Components have a “On Initialized” Event exactly to deal with situations like this. Nothing should “Set State” until “FSM: Is Component Fully Initialized?” node (also in Fsm Component) returns “true”.

Thank you for your help, I’ll check the event later.

Update for Unreal 4.20 released.

Running 4.20.1 build. Activating a state machine gives the following error:


Assertion failed: Pair != nullptr [File:d:\rocketsync\4.20.0-4212847+++ue4+release-4.20\working\engine\source\runtime\core\\Containers/Map.h] [Line: 467]

KERNELBASE
UE4Editor_ApplicationCore
UE4Editor_Core
UE4Editor_Core
UE4Editor_UFSM!UStateMachineComponent::Activate() [d:\build\++portal+dev-marketplace+full\sync\localbuilds\plugintemp\hostproject\plugins\ufsm\source\ufsm\private\ufsm_statemachinecomponent.cpp:70]
UE4Editor_UFSM!UStateMachineComponent::SetActive() [d:\build\++portal+dev-marketplace+full\sync\localbuilds\plugintemp\hostproject\plugins\ufsm\source\ufsm\private\ufsm_statemachinecomponent.cpp:76]
UE4Editor_UFSM!UStateMachineComponent::ActivateFSM() [d:\build\++portal+dev-marketplace+full\sync\localbuilds\plugintemp\hostproject\plugins\ufsm\source\ufsm\private\ufsm_statemachinecomponent.cpp:559]
UE4Editor_UFSM!UStateMachineComponent::execActivateFSM() [d:\build\++portal+dev-marketplace+full\sync\localbuilds\plugintemp\hostproject\plugins\ufsm\source\ufsm\classes\ufsm_statemachinecomponent.h:160]
UE4Editor_CoreUObject

When stepping through the source on line 70 of UFSM_StateMachineComponent.cpp the STATE value was ‘Empty’. Would this have something to do with it?

I’ve identified this bug and fixed.
Was related to recent changes on MakeStates() function moved to be called from within InitProperties(); next update will contain fix for this.

Activate() doesn’t check if your Component have been fully initialized or not; it assumes you’ve built your State array already.
I will add code there to prevent that crash.

Submitted version 2.0 for review (for Unreal 4.18, 4.19, 4.20);
UFSM 2.0 changes:

  • Several internal runtime minor fixes.

  • K2_Enumator” data input and “BP_Enumarator” merged purpose.

  • Global Flow Options moved from Project Settings to individual FSM Component’s Settings section.
    Blueprint Auto Flow Transitions” = true by default;
    Blueprint Auto Flow FSM” = true by default;

  • Unreal Engine might set “Auto Activate” = false checkbox on FSM Components; make sure you have it enabled or the Component will just “sleep”.