Class BindEventAttribute
- Namespace
- JLChnToZ.VRC.Foundation
Binds an event to UdonSharp.UdonSharpBehaviour on build.
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Field, AllowMultiple = true, Inherited = true)]
public class BindEventAttribute : Attribute, IEquatable<BindEventAttribute>
- Inheritance
-
BindEventAttribute
- Implements
- Inherited Members
- Extension Methods
Remarks
There are several ways to use this attribute:
<ul><li><span class="term">Field</span>
You can bind the event in the component in the field.
<example><pre><code class="lang-csharp">[BindEvent(nameof(Button.onClick), nameof(_OnButtonClick)] Button button;
public void _OnButtonClick() { ... }
<example><pre><code class="lang-csharp">[RequireComponent(typeof(Button))]
[BindEvent(typeof(Button), nameof(Button.onClick), nameof(_OnButtonClick))] public class ButtonHandler : UdonSharpBehaviour { public void _OnButtonClick() { ... } }
Constructors
BindEventAttribute(string, string)
public BindEventAttribute(string source, string destination)
Parameters
BindEventAttribute(Type, string, string)
public BindEventAttribute(Type sourceType, string source, string destination)
Parameters
Properties
Destination
The destination event name. (The name of a public method with no arguments)
public string Destination { get; set; }
Property Value
Source
The source event name. (That is the property name of the event)
public string Source { get; set; }
Property Value
SourceType
The source type of the event.
public Type SourceType { get; set; }
Property Value
Remarks
If the component type is different from the field type, you must specify the source type.
Methods
Equals(BindEventAttribute)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(BindEventAttribute other)
Parameters
otherBindEventAttributeAn object to compare with this object.
Returns
Equals(object)
Returns a value that indicates whether this instance is equal to a specified object.
public override bool Equals(object obj)
Parameters
Returns
- bool
true if
objand this instance are of the same type and have identical field values; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer hash code.