I’m currently having a simple use case: From one FSM, send a Event to another FSM.
The problem is, I only have a reference to the Transform of the target object. I know for sure there is a FSMOwner on that object but I can not access it. Solutions:
– Use “SendEvent” action task to send event to a specific GraphOwner as the target agent – but I only have the transform, so it won’t work
– Use a “GetComponent” action task to fetch the GraphOwner component from the target object. But the actions popup does not provide me with a GetComponent<GraphOwner> action. I tried adding GraphOwner as a class to the preferred types editor but it didn’t change anything
– Create a list in the blackboard, add the single target object to it and use the “SendEventToObjects” action. Looks like overkill to me
– Implement a “SendEventToObject” action that works like the plural version but only targets a single object
What would be the “official” way? I have a strong feeling that the absence of the GetComponent<GraphOwner> action is a bug that somehow manifests in my workspace.
Even if you only have a Transform type variable, you can still use it as the “target” of the SendEvent action task. You will notice that the variable selection dropdown when overriding the target agent of the task will list all variables of types derived from Component, as well as of GameObject type. Internally, tasks will get and cache the required component automatically (in this case GraphOwner).
This is of course true for all tasks, both actions and conditions.
Let me know if that works for you, or if I misunderstood something 🙂
Thanks.
Thanks, the “Override agent for specific tasks” is still a very “dark” concept for me. I figured I had a slightly more complex use case, namely “SendEvent” behavior similar to “SendMessage”, that it will send a event to all graph owners inside a specific part of the hierarchy, so I indeed did implement a custom “SendEventToObject” action that allows broadcasting a Event to a hierarchy.
The “override agent” concept is simply a way of telling the task to be executed for a different “target” other than the default “Self” (which is the owner). The required type shown in parenthesis, is the component type that the “target” (either self or overridden) needs to have (at the time of execution) in order for the task to execute correctly.
For all purposes, you can think of this “target” as another parameter of the task, but more specialized in what it’s used for (telling the task which target to execute on).
This whole concept is of course relevant to tasks that actually do something to some specific object (like for example “Move”) rather than tasks that are more of “global” nature (like for example a “Debug.Log” would be).
Let me know if that helps.
Cheers.
Join us on Discord: https://discord.gg/97q2Rjh
Author
Posts
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.
Login
Register
By registering on this website you agree to our Privacy Policy.