Renderer.isVisible

var isVisible : boolean

Description

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

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

using UnityEngine;
using System.Collections;

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

}
}

import UnityEngine
import System.Collections

class example(MonoBehaviour):

def Example():
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.