Api > GameObject > TryGetComponent()
GameObject.TryGetComponent([]{Generic : Component|info} type)⚓︎
Gets the component of the specified type, if it exists.
Parameters:⚓︎
Name | Type | Description |
---|---|---|
type | [ |
info} |
Returns:⚓︎
type | Description |
---|---|
boolean | Returns true if the component is found, false otherwise. |
[ |
info} |
Usage⚓︎
---@type GameObject
local gameobject;
---@type TComponent
local type;
local val0, val1 = gameobject.TryGetComponent(type)