Closed cjacobwade closed 7 months ago
Since this issue was opened the structure of linking yarn functions and commands has changed. More importantly though we have also changed our philosophy on how we see functions and commands working.
Now if you want control over the linking we feel it is best to either modify the action registration generator (action manager replacement), or manually connect through c# using AddCommandHandler.
Thanks for the proposal, it is a good idea but one we don't think is the best approach for Yarn Spinner.
Bare with me this explanation requires a bit of background. In our game we use a component with a scriptableobject asset reference as a way to look up unique objects through string or scriptableobjectdata. UniqueObject and UniqueObjectData are the component and ScriptableObject respectively.
Rather than YarnSpinner's built-in GameObject.Find lookup of the gameobject name it's important for us to use this system for speed and also because we don't enforce gameobjects having non-matching names.
The current API of ActionManager doesn't provide a way to override how gameobjects containing YarnCommands are found which forces a slow lookup and also forces a certain paradigm of how gameobjects are named.
By adding a static Func to ActionManager (and necessarily making that class public rather than internal) users can provide their own optional lookup function without changing the default behaviour
Here's the changes I've made to make this work for our game