wiki.sine.space | sinespace

Difference between revisions of "Scripting/SRenderer"

From wiki.sine.space
Jump to: navigation, search
Line 12: Line 12:
 
{{ScriptFunction|SMaterial|Material|{ get; set; }|Get/Set the material instantiated to the renderer.|
 
{{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);}}
 
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.}}
+
{{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==
 
==Shared Materials==

Revision as of 19:51, 19 April 2017

A renderer is what makes an object appear on the screen.

The SRendererclass component interfaces with Unity's Renderer component, exposing its functions to scripting.

Members

Miscellaneous

IsVisible

bool IsVisible { get; }

Returns true if the renderer is visible on any camera.

if(Space.Host.ExecutingObject.Renderer.IsVisible == true) then
 Space.Log("The Object is Visible!");
else
 Space.Log("The Object is Invisible!");
end


Enabled

bool Enabled { get; set; }

Get/Set if the rendered object is visible.

-- Hide/Show this Object --
function ShowObject(flag)
 Space.Host.ExecutingObject.Renderer.Enabled = flag;
end

ShowObject(false);


Materials

Material

SMaterial Material { get; set; }

Get/Set the material instantiated to the renderer.

-- Change the Object's Colour --
function SetColor(R, G, B, A)
 Space.Host.ExecutingObject.Renderer.Material.SetColor("_Color", R, G, B, A);
end

SetColor(1.0, 0.5, 0.5, 1.0);


Materials[]

SMaterial Materials[] { get; set; }

Get/Set all materials instantiated to the renderer.

local mats = {};
mats = Space.Host.ExecutingObject.Renderer.Materials;
mats[1].SetColor("_Color", 1.0, 1.0, 0.0, 0.5);


Shared Materials

SharedMaterial

SMaterial SharedMaterial { get; set; }

Get/Set the shared material used by the renderer.

No example provided yet


SharedMaterials[]

SMaterial SharedMaterials[] { get; set; }

Get/Set all shared materials used by the renderer.

No example provided yet