This has been a little unclear to me and after some searching, I've decided to open this thread to ask how the flow is directed upon state change. There is some explanation on the wiki with regards to GotoState():
Say, I've got an actor in state "StartUp".
Given:
... I'm now realizing I should just test this code and see for myself ... I suppose I can leave this thread to help answer this question for others.
Anyway, the question was 'In what order are these points reached when I GotoState("NewState");?'.
My guess is that we would see this in the Log:
It's the third one I'm not so sure about. Will the flow trace through all labels shown after "begin:", or just the "begin:" label before going through BeginState()?
But it isn't as clear to me as I'd like.UnrealWiki said:GotoState (optional name NewState, optional name Label)
Switches to a new state. State code execution begins at the specified label or at "Begin:" if Label is not specified. Before the state is changed the old state's EndState function is called. After the state changed BeginState of the new state is called.
Say, I've got an actor in state "StartUp".
Given:
Code:
state StartUp
{
function EndState()
{
Log("StartUp's EndState function was reached.");
}
}
state NewState
{
function BeginState()
{
Log("the BeginState function has been reached.");
}
begin:
Log("the begin label has been reached.");
blahblah:
Log("the blahblah label has been reached.");
}
... I'm now realizing I should just test this code and see for myself ... I suppose I can leave this thread to help answer this question for others.
Anyway, the question was 'In what order are these points reached when I GotoState("NewState");?'.
My guess is that we would see this in the Log:
ScriptLog: StartUp's EndState function was reached.
ScriptLog: the begin label has been reached.
ScriptLog: the blahblah label has been reached.
ScriptLog: the BeginState function has been reached.
It's the third one I'm not so sure about. Will the flow trace through all labels shown after "begin:", or just the "begin:" label before going through BeginState()?