文档

Unity Engine

Unity Engine

IsPowerOfTwo(int)

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

Definition

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)); }}