0
Cannot Reproduce

Custom script: it works in a flow graph, but not in a state machine

snicolast81 3 years ago updated by Lazlo Bonin (Lead Developer) 3 years ago 5

Hello there. First topic here.

First of all I must say I am literally in LOVE with BOLT. It is a totally new and great experience. Good work!

Long story short: I have a flow machine (image01) that works fine. It basically fires a custom script (co-routine in this case) for loading a new level async. I also use a fakeseconds float just to emulate more loading time.

This is working great, as expected.

The problem comes when I translate this into a state machine (image02). When I switch and use the state machine instead the flow graph, the level just loads instantly after I press play, no matter how many seconds I add to the float or even if I try to pause the async operation inside the script (allowSceneActivation). It just loads the scene in the first frame. No error / warning in console.

Image03 is the coroutine script. Very basic stuff, nothing fancy. It works fine as a regular script and inside the isolated flow machine.

Any help would be really appreciate because I would love to make a state machine /manager for my levels, if possible. 

Thank you!

Sergi




Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
Pending Review

Are you sure the value of FakeSecondsDelay is high enough in your state machine?

Can you debug-log it?

Yes, it is the same value (5 seconds). It is a graph variable atm for each flow and state machine (temp).

The state machine is identical to the isolated flow machine, but using the "On Enter State" instead of "Start".

I forgot to mention that in my script you can see there is an asyncOpStatus method. This simple method is linked to a UI Button, so at the end the user is the one responsible to switch between scenes, not the computer. This crucial step is also ignored by the state machine.

Try to replicate it, it is very simple. I do not say I am doing something wrong, but it is basically a copy/paste between the isolated flow graph to the state machine.

I attach the debug.log (written right after the waitforseconds line (43)). This is from the original flow machine, not the state machine. As you can see, it works fine. The start button on top is the one that the player presses to switch level, and the one linked to that asyncOpStatus public method. When the button is pressed/tap, level change.

About the state machine: it just change the level instantly and automatically, and debug log does not show anything. 




Hi snicolas, sorry for the late reply on this.

Can you send me a private ticket with a project in which this issue is replicated and isolated? It would help me figure out what's going on.