Skip to content

Commit

Permalink
fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
KurtGokhan committed Jan 27, 2024
1 parent b2f5766 commit d2d151a
Show file tree
Hide file tree
Showing 3 changed files with 3,346 additions and 3,349 deletions.
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
}
}
11 changes: 4 additions & 7 deletions src/content/learn/howto/extending.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@
title: Extending ReactUnity
---

<Intro>

Extending ReactUnity

</Intro>

## Declaring custom components

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`).

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.

### Example

First we create the custom component. For instance, we are declaring a custom button component that has a red background color.

```cs
Expand Down Expand Up @@ -53,6 +48,7 @@ public class CustomComponentInitializer : MonoBehaviour
```

### Typescript declaration

You may also need to declare your custom component in Typescript

```ts
Expand All @@ -63,7 +59,8 @@ declare global {
}
```

#### Example:
For example:

```ts
declare global {
interface ReactUnityCustomElements {
Expand Down
Loading

0 comments on commit d2d151a

Please sign in to comment.