Skip to content

API > SDKGrab


[Obsolete] SDKGrab⚓︎

The SDKGrab is Obsolete!

SDKGrab inherits from Component

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.OnGrabBeginProperty Invokes when the player grabs the object.
SDKGrab.OnGrabEndProperty Invokes when the player releases the object.
SDKGrab.OnTriggerButonProperty Invokes when the player presses the trigger button on their controller while grabbing to the object.
SDKGrab.OnTriggerReleaseProperty Event handler which gets triggered when the trigger button is released.

Methods⚓︎

Name Description
SDKGrab.ForceRelease() Method Forcefully release the object from player’s hand.

Inherited Members⚓︎

Inherited Properties⚓︎

Name Description
SDKGrab.gameObjectPropertyReadonly Property The game object this component is attached to. A component is always attached to a game object.
SDKGrab.tagPropertyReadonly Property The tag of this game object.
SDKGrab.transformPropertyReadonly Property The Transform attached to this GameObject.
SDKGrab.hideFlagsProperty Should the object be hidden, saved with the Scene or modifiable by the user?
SDKGrab.nameProperty The name of the object.

Inherited Methods⚓︎

Name Description
SDKGrab.BroadcastMessage(methodName, parameter=nil)Method Calls the method named methodName on every Lua Script in this game object or any of its children.
SDKGrab.CompareTag(tag)Method Is this game object tagged with tag ?
SDKGrab.GetAllLuaScripts()Method Returns an array of all Lua scripts that attached to the game object.
SDKGrab.GetComponent(type)Method Returns the component of Type type if the game object has one attached, nil if it doesn't.
SDKGrab.GetComponentInChildren(t)Method Returns the component of Type type in the GameObject or any of its children using depth first search.
SDKGrab.GetComponentInParent(t)Method Returns the component of Type type in the GameObject or any of its parents.
SDKGrab.GetComponents(type)Method Returns all components of Type type in the GameObject.
SDKGrab.GetComponentsInChildren(t)Method Returns all components of Type type in the GameObject or any of its children.
SDKGrab.GetComponentsInParent(t)Method Returns all components of Type type in the GameObject or any of its parents.
SDKGrab.SendMessage(methodName, value=nil)Method Calls the method named methodName on every Lua Script in this game object.
SDKGrab.SendMessageUpwards(methodName, value=nil)Method Calls the method named methodName on every LuaScript in this game object and on every ancestor of the behaviour.
SDKGrab.TryGetComponent(type)Method Gets the component of the specified type, if it exists.
SDKGrab.GetInstanceID()Method 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