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
Copy file name to clipboardExpand all lines: src/content/learn/howto/extending.md
+4-7
Original file line number
Diff line number
Diff line change
@@ -2,19 +2,14 @@
2
2
title: Extending ReactUnity
3
3
---
4
4
5
-
<Intro>
6
-
7
-
Extending ReactUnity
8
-
9
-
</Intro>
10
-
11
5
## Declaring custom components
12
6
13
7
You can declare custom components in ReactUnity. This is useful when you want to create a component that needs to interact with the underlying backend (`ugui` or `uitoolkit`).
14
8
15
9
To declare a custom component, you need to create a new class extending `UGUIComponent` or `UIToolkitComponent` and register it in `UGUIContext.ComponentCreators` or `UIToolkitContext.ComponentCreators` respectively.
16
10
17
11
### Example
12
+
18
13
First we create the custom component. For instance, we are declaring a custom button component that has a red background color.
19
14
20
15
```cs
@@ -53,6 +48,7 @@ public class CustomComponentInitializer : MonoBehaviour
53
48
```
54
49
55
50
### Typescript declaration
51
+
56
52
You may also need to declare your custom component in Typescript
0 commit comments