Version: 2022.3

描述

将整数隐式转换为 LayerMask。

using UnityEngine;

public class Example : MonoBehaviour { void Start() { // Converts an integer to a layer and prints the layer name.

int i = 0; LayerMask layerMask; layerMask = i; Debug.Log(LayerMask.LayerToName(layerMask)); } }