You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 9, 2023. It is now read-only.
Event extensions have a prefix "RxVRTK_" and a suffix "Extension".
43
+
44
+
45
+
### 2. RxVRTK components
46
+
47
+
**RxVRTK components** provide an event system that registers a callback by its method name and the registered callbacks are automatically called by the event system of VRTK.
48
+
49
+
An RxVRTK component inherits from VRTK classes and overrides the aforementioned methods so that it converts a VRTK event to Rx stream. When you use these components, you **must not** override such methods and **must** only use observable methods instead.
50
+
51
+
52
+
### Note
53
+
54
+
Let's say you want to register a callback for "StartUsing". In this case, VRTK calls "StartUsing" of an VRTK_InteractableObject instance if it implements a method that matches the following signature:
As these methods are already overridden in RxVRTK_InteractableObject, which inherits VRTK_InteractableObject to fire UniRx events and RxVRTK utilizes this technique to register an event callback, ensure that you **do not** use neither "StartUsing" nor `new` to hide this method.
61
+
62
+
63
+
### Example: RxVRTK components
64
+
The base class of RxVRTK_InteractableObject is **VRTK_InteractableObject**. This class provides interactive events: StartUsing, StartTouching, Grabbed, etc.
65
+
66
+
```csharp
67
+
usingRxVRTK;
68
+
usingUniRx;
69
+
usingUnityEngine;
70
+
71
+
publicclassSomeObject : RxVRTK_InteractableObject
72
+
{
73
+
protectedvoidStart()
74
+
{
75
+
this.StartUsingAsObservable()
76
+
.Subscribe(user=>
77
+
{
78
+
Debug.Log(user.name+" is using this object!");
79
+
});
80
+
}
81
+
}
82
+
83
+
```
84
+
85
+
86
+
RxVRTK components have a prefix "RxVRTK_" but no suffix.
87
+
88
+
89
+
## License
90
+
This library is released under the [MIT License](https://github.com/0V/RxVRTK/blob/master/LICENSE).
0 commit comments