SDKGrab
7/14/25About 2 min
[Obsolete] SDKGrab
Caution
The SDKGrab is Obsolete!
Info
SDKGrab inherits from [Component](/docs/create/lua/API/Component/index.html)
The Lua interface for SDKGrab component. Add this component to any object to make it grabbable. You can access to various events of the component.
Members
Properties
Name | Description |
---|---|
SDKGrab .OnGrabBegin | Invokes when the player grabs the object. |
SDKGrab .OnGrabEnd | Invokes when the player releases the object. |
SDKGrab .OnTriggerButon | Invokes when the player presses the trigger button on their controller while grabbing to the object. |
SDKGrab .OnTriggerRelease | Event handler which gets triggered when the trigger button is released. |
Methods
Name | Description |
---|---|
SDKGrab .ForceRelease() | Forcefully release the object from player’s hand. |
Inherited Members
Inherited Properties
Name | Description |
---|---|
SDKGrab .gameObject | The game object this component is attached to. A component is always attached to a game object. |
SDKGrab .tag | The tag of this game object. |
SDKGrab .transform | The Transform attached to this GameObject. |
SDKGrab .hideFlags | Should the object be hidden, saved with the Scene or modifiable by the user? |
SDKGrab .name | The name of the object. |
Inherited Methods
Name | Description |
---|---|
SDKGrab .BroadcastMessage(methodName, parameter=nil) | Calls the method named methodName on every Lua Script in this game object or any of its children. |
SDKGrab .CompareTag(tag) | Is this game object tagged with tag ? |
SDKGrab .GetAllLuaScripts() | Returns an array of all Lua scripts that attached to the game object. |
SDKGrab .GetComponent(type) | Returns the component of Type type if the game object has one attached, nil if it doesn't. |
SDKGrab .GetComponentInChildren(t) | Returns the component of Type type in the GameObject or any of its children using depth first search. |
SDKGrab .GetComponentInParent(t) | Returns the component of Type type in the GameObject or any of its parents. |
SDKGrab .GetComponents(type) | Returns all components of Type type in the GameObject. |
SDKGrab .GetComponentsInChildren(t) | Returns all components of Type type in the GameObject or any of its children. |
SDKGrab .GetComponentsInParent(t) | Returns all components of Type type in the GameObject or any of its parents. |
SDKGrab .SendMessage(methodName, value=nil) | Calls the method named methodName on every Lua Script in this game object. |
SDKGrab .SendMessageUpwards(methodName, value=nil) | Calls the method named methodName on every LuaScript in this game object and on every ancestor of the behaviour. |
SDKGrab .TryGetComponent(type) | Gets the component of the specified type, if it exists. |
SDKGrab .GetInstanceID() | Returns the instance id of the object. |
Example
How to get the component:
do
local script = LUA.script;
local obj = script.gameObject;
local function onFire()
Debug.Log("Bang!");
end
function script.Start()
local grab = obj.GetComponent(SDKGrab);
grab.OnTriggerButon.Add(onFire);
end
end