Version: 2017.3

Mathf.NextPowerOfTwo

切换到手册
public static int NextPowerOfTwo (int value);

描述

返回下一个 2 的幂值。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Example() { Debug.Log(Mathf.NextPowerOfTwo(7)); Debug.Log(Mathf.NextPowerOfTwo(139)); } }