How to find and call a function on a scene object from UnityEvent that has a prefab referenced.
I have a UnityEvent
field on a ScriptableObject, it accepts only prefab objects. How can I find that prefab in the scene and run that function in it.
I can get the Component
referenced from UnityEvent and use that to find the object, but it only gives the function as a string.
And Components have no Invoke()
on them, and SendMessage()
doesn't seem to work on built-in components (I get "no receiver" error).
I feel like I've missed something obvious, and there is a much simpler way to do this. But at this point I could even go for a spaghetti solution as long as it works.
Answer by Bandit358 · Jul 25, 2019 at 04:08 PM
Bypassed it by registering events on a scene object then before invoking from a scrtiptableobject checking if this event exits in scene and invoking it there.
Your answer
Follow this Question
Related Questions
Checking for conditions on hundreds of ScriptableObjects 0 Answers
Disable a group of scripts based on base class. 0 Answers
Way to assign event fields in created at runtime scriptable object (ScriptableObject Architecture) 0 Answers
How do I make a Status Effect system in a turn based combat RPG ? 0 Answers
How to add Components to some individuals parts of a prefab 1 Answer