文档

Unity Engine

Unity Engine

IsPowerOfTwo(int)

Returns true if the value is power of two.
阅读时间1 分钟最后更新于 1 个月前

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public static bool IsPowerOfTwo(int value)

Parameters

value

Returns

Type

Description

bool

Examples

using UnityEngine;public class Example : MonoBehaviour{ void Start() { // prints false Debug.Log(Mathf.IsPowerOfTwo(7)); // prints true Debug.Log(Mathf.IsPowerOfTwo(32)); }}