format
typescript
ComponentSettings.ExecuteMultiple()class: ComponentSettings
description
By default, only one component of the same type can be added to the same object. After using this decorator, multiple components of the same type can be added to the same object.
parameter
| param_name | type | description |
|---|
return
| type | description |
|---|---|
void |
code example
javascript
@ComponentSettings.ExecuteMultiple()
class Test
extends Component
implements IOnUpdate, IOnCollisionEnter {
OnCollisionEnter(collision: Collision): void {
}
OnUpdate(): void {
Debug.Log("on updating!");
}
}
function main() {
var go = new GameObject("abc");
go.AddComponent(Test);
go.AddComponent(Test);
}