Mathf.ClosestPowerOfTwo Manual     Reference     Scripting  
Scripting > Runtime Classes > Mathf
Mathf.ClosestPowerOfTwo

static function ClosestPowerOfTwo (value : int) : int

Description

Returns the closest power of two value.

JavaScripts
using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
void Awake() {
Debug.Log(Mathf.ClosestPowerOfTwo(7));
Debug.Log(Mathf.ClosestPowerOfTwo(19));
}
}

import UnityEngine
import System.Collections

class example(MonoBehaviour):

def Awake():
Debug.Log(Mathf.ClosestPowerOfTwo(7))
Debug.Log(Mathf.ClosestPowerOfTwo(19))