Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

LightProbes.IsActive

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static bool IsActive(LightProbes lightProbes);

Parameters

Parameter Description
lightProbes The LightProbes object to query for its active status.

Returns

bool true if the reference count is greater than zero; otherwise false.

Description

Indicates whether the LightProbes object is currently registered for use in rendering.

An object becomes active after a call to LightProbes.Append, and remains active until a corresponding number of LightProbes.Remove calls bring its reference count back to zero. While inactive, the object is not registered for use in rendering. Loading or unloading a scene that contains light probes has the same effect, because Unity calls LightProbes.Append and LightProbes.Remove automatically for the LightProbes objects belonging to that scene.

Additional resources: LightProbes.Append, LightProbes.Remove, LightProbes.GetReferenceCount.

// Attach this script to a GameObject, then enter Play mode.
// The script appends a LightProbes object twice, then removes it, logging whether
// it is active at each step so you can observe when it is registered for rendering.

using UnityEngine; using UnityEngine.Rendering;

public class IsActiveExample : MonoBehaviour { void Start() { LightProbes probes = new LightProbes(1); probes.SetPositionsSelf(new Vector3[] { transform.position }, false); probes.SetSHCoefficientsSelf(new SphericalHarmonicsL2[1]);

LightProbes.Append(probes); LightProbes.Append(probes); Debug.Log($"After two Append calls: {LightProbes.IsActive(probes)}");

LightProbes.Remove(probes); Debug.Log($"After one Remove call: {LightProbes.IsActive(probes)}");

LightProbes.Remove(probes); Debug.Log($"After two Remove calls: {LightProbes.IsActive(probes)}");

LightProbes.Tetrahedralize(); } }