Sinespace Client 2025.3.19431
Client-side scripting for Sinespace
SineSpace.Scripting.Components.SClickable Class Reference
Inheritance diagram for SineSpace.Scripting.Components.SClickable:
ScriptClassComponent< T > ScriptClass< T > ScriptClassWrapper< T > ScriptClass

Public Member Functions

void AddExtraAction (string name, string tooltip, Action e)
 
void AddExtraAction (string name, string tooltip, Closure e)
 Add a new action for the object to perform when clicked. Can be useful for providing multiple choice of an action on click.
 
void ClearActions ()
 Removes all actions from the clickable GameObject.
 
void OnClick (Action e)
 
void OnClick (Closure e)
 When clicked, the GameObject performs the required action.
 
void InvokeClick ()
 Invoke a "click" on a Clickable component, as if the user had clicked on it themselves.
 
- Public Member Functions inherited from ScriptClassWrapper< T >
override void Initialise (SScript runtime, object wrapper)
 
- Public Member Functions inherited from ScriptClass
void ReportError (string error, bool fatal, UnityEngine.Object target=null)
 
void Initialise (SScript runtime, object wrapper)
 

Properties

bool Enabled [get, set]
 Enable or disable the clickable component from a GameObject.
 
string Tooltip [get, set]
 A hint that pops up when the mouse is hovering over the GameObject.
 
- Properties inherited from ScriptClassComponent< T >
SGameObject GameObject [get]
 Return the GameObject which component added.
 
- Properties inherited from ScriptClass< T >
override bool Alive [get]
 Return if the component is alive.
 
- Properties inherited from ScriptClassWrapper< T >
_wrap [get]
 
- Properties inherited from ScriptClass
virtual bool Alive [get]
 
DynValue CachedData [get, set]
 

Additional Inherited Members

- Protected Member Functions inherited from ScriptClass
void Initialise (SScript runtime)
 

Member Function Documentation

◆ AddExtraAction() [1/2]

void SineSpace.Scripting.Components.SClickable.AddExtraAction ( string name,
string tooltip,
Action e )

◆ AddExtraAction() [2/2]

void SineSpace.Scripting.Components.SClickable.AddExtraAction ( string name,
string tooltip,
Closure e )

Add a new action for the object to perform when clicked. Can be useful for providing multiple choice of an action on click.

hostObject = Space.Host.ExecutingObject;
&ndash;Add Clickable component to the GameObject
hostObject.AddClickable();
function ClickMeAndCount ()
local n = 0;
return function ()
n = n+1;
Space.Log("I was clicked " .. n .. " times!");
end
end
local f = ClickMeAndCount ();
hostObject.Clickable.AddExtraAction ("Click me and count", "Prints to the console
how many times I was clicked", f);
&ndash;Add the closure to action.
SGameObject GameObject
Return the GameObject which component added.
Definition ScriptClass.cs:25
void AddExtraAction(string name, string tooltip, Action e)
Definition SClickable.cs:65

◆ ClearActions()

void SineSpace.Scripting.Components.SClickable.ClearActions ( )

Removes all actions from the clickable GameObject.

hostObject = Space.Host.ExecutingObject;
hostObject.AddClickable();
function ClickMe ()
Space.Log("I was clicked!");
end
function ClickAndClear ()
Space.Log("No more actions!");
hostObject.Clickable.ClearActions ();
end
hostObject.Clickable.AddExtraAction ("Click me", "Prints I was clicked! to the console", ClickMe);
hostObject.Clickable.AddExtraAction ("Click And Clear", "Clears all actions", ClickAndClear);
&ndash;Add both function to extra action.
&ndash; Now, when the latter option is chosen, the script clears the Clickable component of all actions.
void ClearActions()
Removes all actions from the clickable GameObject.
Definition SClickable.cs:130

◆ InvokeClick()

void SineSpace.Scripting.Components.SClickable.InvokeClick ( )

Invoke a "click" on a Clickable component, as if the user had clicked on it themselves.

hostObject = Space.Host.ExecutingObject;
hostObject.AddClickable();
function ClickMe()
Space.Log("I was clicked!");
end
hostObject.Clickable.OnClick(ClickMe);
hostObject.Clickable.InvokeClick();
void InvokeClick()
Invoke a "click" on a Clickable component, as if the user had clicked on it themselves.
Definition SClickable.cs:206
void OnClick(Action e)
Definition SClickable.cs:137

◆ OnClick() [1/2]

void SineSpace.Scripting.Components.SClickable.OnClick ( Action e)

◆ OnClick() [2/2]

void SineSpace.Scripting.Components.SClickable.OnClick ( Closure e)

When clicked, the GameObject performs the required action.

hostObject = Space.Host.ExecutingObject;
hostObject.AddClickable();
function ClickAndCount ()
n = 0;
return function ()
n = n+1;
Space.Log("I was clicked " .. n .. " times!");
end
end
local f = ClickAndCount ();
&ndash;Register the closure to clickable.
hostObject.Clickable.OnClick (f);

Property Documentation

◆ Enabled

bool SineSpace.Scripting.Components.SClickable.Enabled
getset

Enable or disable the clickable component from a GameObject.

Scene = Space.Scene
&ndash;Get the scene where you are.
Cube = Scene.Find(“Cube”)
&ndash;Get the cube game object you have set there
Clickable=Cube.AddClickable();
&ndash;Add and get the clickable value.
Clickable.Enabled = false
&ndash;Set clickable active.
Definition SAudioAnalyser.cs:4

◆ Tooltip

string SineSpace.Scripting.Components.SClickable.Tooltip
getset

A hint that pops up when the mouse is hovering over the GameObject.

hostObject = Space.Host.ExecutingObject;
hostObject.AddClickable();
&ndash; Prints an empty string to the console - Tooltip is empty upon initializing.
hostObject.Clickable.Tooltip = "I am clickable!";
&ndash; Now, when a mouse is hovered for a few seconds over the object, "I am clickable!" will appear.
string Tooltip
A hint that pops up when the mouse is hovering over the GameObject.
Definition SClickable.cs:58