Skip to main content

WheelCollider.TryGetComponent(TComponent type)

Gets the component of the specified type, if it exists.

Parameters:

NameTypeDescription
typeTComponentThe type of the component to retrieve.

Returns:

typeDescription
booleanReturns true if the component is found, false otherwise.
TComponentThe output argument that will contain the component or nil.

Usage

---@type WheelCollider
local wheelcollider;

---@type TComponent
local type;


local val0, val1 = wheelcollider.TryGetComponent(type)

Example

exists, component = myComponent.TryGetComponent(Transform);
-- exists is a boolean
-- component is Component or nil