Hello,
Can I get the name of the running graph and/or state?
Something like this:
In this case the graph’s name is “Dummy State”.
How can I get the name for using it in the graph?
Thank you
Hello,
Can I get the name of the running graph and/or state?
Something like this:
In this case the graph’s name is “Dummy State”.
How can I get the name for using it in the graph?
Thank you
This gets the state machine name, but not the inner state where the subgraph is running. I mean the script state name
I’m getting “Scene Flow”, but I need “Dummy State”
Oh I see, you’re looking to get the nested Subgraph from within the state graph.
It does not appear to work like that with nested graphs that don’t have an Object with the Graph Component but I could be wrong. may I ask why you’re looking to reference just the string name of a nested subgraph?
maybe there’s another way to do the same final result you’re looking for?
are you just trying to send triggers?
No big deal, no worries.
I am doing a scene flow manager based on visual scripting.
Each state is a scene, and you can go between scenes/states, loading and unloading the scene.
Each state is the same, the only different is the target scene. So I was using a variable to define which is the loading scene. But the state name is actually the scene name, so I was playing around with the idea of getting the state name for using it as scene name.
The visual scripting has toons of nodes, so it thought I couldn’t find the correct node to get the state params (such as name, current status, etc).
Anyway, it’s more a curiosity than a necessity, I can use a graph variable, although I think such a node like I’m asking could be helpful, for debugging for example
Okay, you can just get the String Name of the Active Scene and have that transition to the correct node.
This is how I would set it up.
First, we make a Start State that every scene will start in. then send its transitions down to the corresponding Scene state with a Custom Trigger. We can’t just start in Scene 1. We need to create the Enter State. Kind of like how the Animator Component starts off from a start state.
Any state toggled Green will be running or Active.
Right click them and Select Toggle Start to make a State Active or not active.
Inside the starting Select Scene State, on Enter State we just Get the Active Scene and Get it’s Name as a string and trigger a Custom Event.
Next, we need to configure the Transitions to accept the Custom Trigger Events to tell it to transition to the appropriate State.
Inside one of the Transitions we can see the Custom Event Triggering the Transitions. it’s like this in all 3 transitions but with the appropriate string as the input
Now inside each duplicate state is the code for the appropriate state. in this case we just print a message to console.
We can also select the next scene with spacebar
Here is what the console will print out
You’ll also have to make sure all the scenes are in the Build Settings