「毎日Unity」の技術ブログ

開発で役立つ情報を発信する

【UnityC#】乗数を得る方法

乗数を得る方法を自分用にメモ。

[ 方法 ]

「Mathf.Pow(a, b)」で乗数を得ることができます。aが底でbが指数です。

[ 使用例 ]

下記は2の6乗をコンソールに出力するスクリプトです。

using System;
using System.Collections.Generic;
using UnityEngine;

public class ScriptTest : MonoBehaviour
{
    void Start()
    {
        int IntTest = 0;
        IntTest = Mathf.Pow(2, 6);

        Debug.Log(IntTest);
    }
}

2の6乗は64ですね。