m |
|||
Line 1: | Line 1: | ||
A renderer is what makes an object appear on the screen. | A renderer is what makes an object appear on the screen. | ||
− | The | + | The SRenderer class component interfaces with Unity's Renderer component, exposing its functions to scripting. |
− | = | + | =Properties= |
− | + | {{ScriptFunction|bool|IsVisible|{ get; }|Returns true if the renderer is visible on any camera.|5=<pre> | |
− | {{ScriptFunction|bool|IsVisible|{ get; }|Returns true if the renderer is visible on any camera.|5= | + | isVisible = Space.Host.ExecutingObject.Renderer.IsVisible</pre>|6=<pre></pre> }} |
− | + | ||
− | {{ScriptFunction|bool|Enabled|{ get; set; }|Get/Set if the rendered object is visible.|5= | + | {{ScriptFunction|bool|Enabled|{ get; set; }|Get/Set if the rendered object is visible.|5=<pre>Space.Host.ExecutingObject.Renderer.Enabled = false </pre>|6=<pre>--clicking this object will make it disappear/reappear |
− | + | ||
− | + | ||
thisGameObject = Space.Host.ExecutingObject | thisGameObject = Space.Host.ExecutingObject | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
OnClick = function() | OnClick = function() | ||
− | + | thisGameObject.Renderer.Enabled = not thisGameObject.Renderer.Enabled | |
end | end | ||
thisGameObject.AddClickable() | thisGameObject.AddClickable() | ||
− | |||
thisGameObject.Clickable.OnClick(OnClick)</pre>}} | thisGameObject.Clickable.OnClick(OnClick)</pre>}} | ||
− | + | ||
{{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= | + | 5=<pre>Space.Host.ExecutingObject.Renderer.Material.SetColor("_Color", 1.0, 0.5, 0.5, 1.0)</pre>|6=<pre></pre>}} |
− | {{ScriptFunction|SMaterial|Materials[]|{ get; set; }|Get/Set all materials instantiated to the renderer.|5= | + | {{ScriptFunction|SMaterial|Materials[]|{ get; set; }|Get/Set all materials instantiated to the renderer.|5=<pre>mats = Space.Host.ExecutingObject.Renderer.Materials</pre>|6=<pre></pre>}} |
+ | |||
− | |||
{{ScriptFunction|SMaterial |SharedMaterial|{ get; set; }|Get/Set the shared material used by the renderer.|5=Refer to member Material.}} | {{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.}} | {{ScriptFunction|SMaterial|SharedMaterials[]|{ get; set; }|Get/Set all shared materials used by the renderer.|5=Refer to member Materials.}} | ||
{{Scripting Navbox}} | {{Scripting Navbox}} |
A renderer is what makes an object appear on the screen.
The SRenderer class component interfaces with Unity's Renderer component, exposing its functions to scripting.
Returns true if the renderer is visible on any camera.
isVisible = Space.Host.ExecutingObject.Renderer.IsVisible
Get/Set if the rendered object is visible.
Space.Host.ExecutingObject.Renderer.Enabled = false
--clicking this object will make it disappear/reappear thisGameObject = Space.Host.ExecutingObject OnClick = function() thisGameObject.Renderer.Enabled = not thisGameObject.Renderer.Enabled end thisGameObject.AddClickable() thisGameObject.Clickable.OnClick(OnClick)
Get/Set the material instantiated to the renderer.
Space.Host.ExecutingObject.Renderer.Material.SetColor("_Color", 1.0, 0.5, 0.5, 1.0)
Get/Set all materials instantiated to the renderer.
mats = Space.Host.ExecutingObject.Renderer.Materials
Get/Set the shared material used by the renderer.
Get/Set all shared materials used by the renderer.
|