IActionRegistration
public interface IActionRegistration#Methods
#AddCommandHandler(string, Delegate)
void AddCommandHandler(string commandName, Delegate handler);Parameters
commandNamestringThe name of the command.handlerDelegateTheCommandHandlerthat will be invoked when the command is called.
You can also register commands via the YarnCommandAttribute attribute on your methods.
When this command handler has been added, it can be called from your Yarn scripts like so:
<<commandName param1 param2>>
If handler is a method that returns a YarnTask, Task, Awaitable, or UniTask when the command is run, the DialogueRunner will wait for the task to finish before delivering any more content.
If handler is a method that returns a Coroutine, when the command is run, the DialogueRunner will wait for the returned coroutine to stop before delivering any more content.
If handler is a method that returns an System.Collections.IEnumerator, when the command is run, the DialogueRunner will start a coroutine using that method and wait for that coroutine to stop before delivering any more content.
#AddCommandHandler(string, MethodInfo)
void AddCommandHandler(string commandName, MethodInfo methodInfo);Parameters
commandNamestringThe name of the command.handler(unknown)TheCommandHandlerthat will be invoked when the command is called.commandName(unknown)The name of the command.methodInfoMethodInfoThe method that will be invoked when the command is called.
You can also register commands via the YarnCommandAttribute attribute on your methods.
When this command handler has been added, it can be called from your Yarn scripts like so:
<<commandName param1 param2>>
If handler is a method that returns a YarnTask, Task, Awaitable, or UniTask when the command is run, the DialogueRunner will wait for the task to finish before delivering any more content.
If handler is a method that returns a Coroutine, when the command is run, the DialogueRunner will wait for the returned coroutine to stop before delivering any more content.
If handler is a method that returns an System.Collections.IEnumerator, when the command is run, the DialogueRunner will start a coroutine using that method and wait for that coroutine to stop before delivering any more content.
#AddFunction(string, Delegate)
void AddFunction(string name, Delegate implementation);Parameters
namestringThe name of the function to add.implementationDelegateTheSystem.Delegatethat should be invoked when this function is called.
You can also register functions via the YarnFunctionAttribute attribute on your methods.
When this function has been registered, it can be called from your Yarn scripts like so:
<<if myFunction(1, 2) == true>>
myFunction returned true!
<<endif>>
See also
Library
#RemoveCommandHandler(string)
void RemoveCommandHandler(string commandName);Parameters
commandNamestringThe name of the command to remove.
#RemoveFunction(string)
void RemoveFunction(string name);Parameters
namestringThe name of the function to remove.
After a function has been removed, it cannot be called from Yarn scripts.
This does not impact the compiled Yarn program, only the runtime actions. The Yarn VM will still attempt to call the function when it encounters it, likely resulting in an exception being thrown. In general you should only remove functions if you know they won't be needed.
See also
Generated from Yarn Spinner for Unity 3.3.