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.
CloseFor 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.
CloseImplicitly converts uint
to a RenderingLayerMask.
using UnityEngine; using UnityEngine.Rendering;
public class Example : MonoBehaviour { void Start() { // Converts a uint to a rendering layer and prints all the rendering layer names. // As the value is 1025, it will print "Default" and Rendering Layer 10 Name. // 2^0 + 2^10 = 1 + 1024 = 1025
uint number = 1025; RenderingLayerMask mask = number; for (int i = 0; i < 32; i++) { if ((mask.value & (1 << i)) != 0) { Debug.Log($"Rendering Layer {i}: {RenderingLayerMask.RenderingLayerToName(i)}"); } } } }