編輯

共用方式為


ComponentExtensions Class

Definition

Extensions methods for the Unity Component class. This also includes some component-related extensions for the GameObject class.

public ref class ComponentExtensions abstract sealed
public static class ComponentExtensions
type ComponentExtensions = class
Public Module ComponentExtensions
Inheritance
ComponentExtensions

Methods

EnsureComponent(GameObject, Type)

Ensure that a component of type exists on the game object. If it doesn't exist, creates it.

EnsureComponent<T>(Component)

Ensure that a component of type T exists on the game object. If it doesn't exist, creates it.

EnsureComponent<T>(GameObject)

Ensure that a component of type T exists on the game object. If it doesn't exist, creates it.

FindAncestorComponent<T>(Component, Boolean)

Find the first component of type T in the ancestors of the game object of the specified component.

Applies to