Renderer.isVisible Manual     Reference     Scripting  
Scripting > Runtime Classes > Renderer
Renderer.isVisible

var isVisible : bool

Description

Is this renderer visible in any camera? (Read Only)

JavaScripts
if (renderer.isVisible)
ProcessData.AndDoSomeComplexEffect();

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
void Awake() {
if (renderer.isVisible)
ProcessData.AndDoSomeComplexEffect();

}
}

import UnityEngine
import System.Collections

class example(MonoBehaviour):

def Awake():
if renderer.isVisible:
ProcessData.AndDoSomeComplexEffect()

Note that object is considered visible when it needs to be rendered in the scene. It might not be actually visible by any camera, but still need to be rendered for shadows for example. Also, when running in the editor, the scene view cameras will also cause this value to be true.

See Also: OnBecameVisible, OnBecameInvisible.