Mike (CNDG) (Talk | contribs) |
|||
Line 7: | Line 7: | ||
{{ScriptFunction|bool|IsVisible|{ get; }|Returns true if the renderer is visible on any camera.|5= | {{ScriptFunction|bool|IsVisible|{ get; }|Returns true if the renderer is visible on any camera.|5= | ||
if(Space.Host.ExecutingObject.Renderer.IsVisible == true) then<br> Space.Log("The Object is Visible!");<br>else<br> Space.Log("The Object is Invisible!");<br>end}} | if(Space.Host.ExecutingObject.Renderer.IsVisible == true) then<br> Space.Log("The Object is Visible!");<br>else<br> 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> Space.Host.ExecutingObject.Renderer.Enabled = flag;<br>end<br><br>ShowObject(false);}} | + | |
+ | |||
+ | {{ScriptFunction|bool|Enabled|{ get; set; }|Get/Set if the rendered object is visible.|5=-- Hide/Show this Object --<br>function ShowObject(flag)<br> 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== | ==Materials== |
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.
Returns true if the renderer is visible on any camera.
Get/Set if the rendered object is visible.
--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)
Get/Set the material instantiated to the renderer.
Get/Set all materials instantiated to the renderer.
Get/Set the shared material used by the renderer.
Get/Set all shared materials used by the renderer.
|