YarnStateInjectorAttribute

Class in Yarn.Unity

Inherits from Attribute

Summary

Inject state for any commands in this class using this static method.

public class YarnStateInjectorAttribute : Attribute

Remarks

The method will be expected to take a string, and return an entity of the same type as the class being operated on. (So, for example, an injector for BoxCollider would take in a string and find a BoxCollider.)

By default, Yarn will use GameObject.Find(string) if there is no injector defined. This is fairly inefficient (an O(n) lookup), so it is recommended that you restrict your lookup conditions so that you can find it quicker (eg, a cache).

This injector should be a static function. Non-static functions will be ignored.

Properties

NameDescription

Method to use as an injector.

Last updated

Yarn Spinner® and Secret Lab® are trade marks of Secret Lab Pty. Ltd., and are used by Yarn Spinner Pty. Ltd. under license.