神様は有休消化中です。

Unity関連の技術ネタを書いてます。

2015-09-26から1日間の記事一覧

【Unity5】【C#】string.StartsWithが激重いのでstring.IndexOfを使おう

先日Unityのプロファイラーを眺めていたところ、string.StartsWithが激重いことに気づいたので共有。テスト用にこんなスクリプトを実行。 using UnityEngine; using System.Collections; public class Hoge : MonoBehaviour { void Update () { string hoge …

【Unity5】Vector3.DotとMathf.Acosの組み合わせでNan発生

Vector3.Dotで取得したラジアン値をMathf.Acosに突っ込んだところNanが発生することがあったので共有。 以下のようなソースで出ました。 Vector3 a = (end - start).normalize; Vector3 b = hoge.transform.rotation * Vector3.forward; float rad = Vector3…