Math.Sin、Mathf.Sinの速度比較をしたので結果を残しておきます。
[ 環境 ]
Unity 2018.4.14.f1
[ 比較結果 ]
Math.Sin | 20 ms |
Mathf.Sin | 30 ms |
[ スクリプト ]
using System.Collections; using System.Collections.Generic; using UnityEngine; using System; public class PerformanceComparison : MonoBehaviour { void Start() { System.Diagnostics.Stopwatch StopWatch = new System.Diagnostics.Stopwatch(); int Count = 1000000; //Math.Sin StopWatch.Restart(); for(float i = 0; i < Count; i++) { float Temporary = (float)Math.Sin((double)i); } Debug.Log(StopWatch.ElapsedMilliseconds); //Mathf.Sin StopWatch.Restart(); for(float i = 0; i < Count; i++) { float Temporary = Mathf.Sin(i); } Debug.Log(StopWatch.ElapsedMilliseconds); } }