もっとも近い 2 のべき乗の値を返す。
// prints 8 Debug.Log(Mathf.ClosestPowerOfTwo(7)); // prints 16 Debug.Log(Mathf.ClosestPowerOfTwo(19));
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { void Example() { Debug.Log(Mathf.ClosestPowerOfTwo(7)); Debug.Log(Mathf.ClosestPowerOfTwo(19)); } }