wiki.sine.space | sinespace

Difference between revisions of "Scripting/SRenderer"

From wiki.sine.space
Jump to: navigation, search
(Replaced content with "This page has moved to: https://docs.sine.space/v/scripting/client-scripting/components/srenderer")
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
A renderer is what makes an object appear on the screen.
+
This page has moved to: https://docs.sine.space/v/scripting/client-scripting/components/srenderer
 
+
The SRendererclass component interfaces with Unity's Renderer component, exposing its functions to scripting.
+
 
+
=Members=
+
==Miscellaneous==
+
{{ScriptFunction|bool|IsVisible|{ get; }|Returns true if the renderer is visible on any camera.|5=
+
if(Space.Host.ExecutingObject.Renderer.IsVisible == true) then<br>&nbsp;Space.Log("The Object is Visible!");<br>else<br>&nbsp;Space.Log("The Object is Invisible!");<br>end}}
+
 
+
 
+
{{ScriptFunction|bool|Enabled|{ get; set; }|Get/Set if the rendered object is visible.|5=-- Hide/Show this Object --<br>function ShowObject(flag)<br>&nbsp;Space.Host.ExecutingObject.Renderer.Enabled = flag;<br>end<br><br>ShowObject(false);|6=<pre>
+
--the below script will make this object disappear
+
--for 10 seconds then reappear again (clickable)
+
--(Example: toilet being flushed)
+
 
+
thisGameObject = Space.Host.ExecutingObject
+
 
+
 
+
DisappearCoroutine = function()
+
thisGameObject.Renderer.Enabled = false
+
coroutine.yield(10)
+
thisGameObject.Renderer.Enabled = true
+
end
+
 
+
OnClick = function()
+
thisGameObject.Active = false
+
end
+
 
+
thisGameObject.AddClickable()
+
thisGameObject.Clickable.Tooltip="Flush me!"
+
thisGameObject.Clickable.OnClick(OnClick)
+
 
+
Space.Host.StartCoroutine(DisappearCoroutine)</pre>}}
+
 
+
==Materials==
+
{{ScriptFunction|SMaterial|Material|{ get; set; }|Get/Set the material instantiated to the renderer.|
+
5=-- Change the Object's Colour --<br>function SetColor(R, G, B, A)<br>&nbsp;Space.Host.ExecutingObject.Renderer.Material.SetColor("_Color", R, G, B, A);<br>end<br><br>SetColor(1.0, 0.5, 0.5, 1.0);}}
+
{{ScriptFunction|SMaterial|Materials[]|{ get; set; }|Get/Set all materials instantiated to the renderer.|5=local mats = {};<br>mats = Space.Host.ExecutingObject.Renderer.Materials;<br>mats[1].SetColor("_Color", 1.0, 1.0, 0.0, 0.5);}}
+
 
+
==Shared Materials==
+
{{ScriptFunction|SMaterial |SharedMaterial|{ get; set; }|Get/Set the shared material used by the renderer.|5=Refer to member Material.}}
+
{{ScriptFunction|SMaterial|SharedMaterials[]|{ get; set; }|Get/Set all shared materials used by the renderer.|5=Refer to member Materials.}}
+
 
+
{{Scripting Navbox}}
+

Latest revision as of 06:19, 19 September 2022

This page has moved to: https://docs.sine.space/v/scripting/client-scripting/components/srenderer