Accessing Other Components
Get and Add Components
// File 1
export default class Test extends AirshipBehaviour {}
// File 2
export default class MyComponent extends AirshipBehaviour {
public Start() {
// Adding a Unity and Airship component:
this.gameObject.AddComponent<BoxCollider>();
this.gameObject.AddAirshipComponent<Test>();
// Get Unity and Airship components:
const boxCollider = this.gameObject.GetComponent<BoxCollider>();
const test = this.gameObject.GetAirshipComponent<Test>();
}
}Performance Considerations
Last updated