Skip to main content

GameObject.GetComponent(TComponent type)

Returns the component of Type type if the game object has one attached, null if it doesn't.

Parameters:

NameTypeDescription
typeTComponentThe type of Component to retrieve.

Returns:

typeDescription
TComponentcomponent of Type

Usage

---@type GameObject
local gameobject;

---@type TComponent
local type;


local val0 = gameobject.GetComponent(type)