ロバメモ - 素人のUnity覚書と奮闘記

素人のUnity覚書と奮闘記

データ型

float値の比較は危険だった

二つの座標を比較した時にはまったのでメモ。 問題点 そのままfloat同士で比較 10掛けて切り捨ててみる(float型のまま) それをintにしてみる 文字列しにしてからintにしてみる エラー対策 結論 等しいかどうかを調べる 問題点 そのままfloat同士で比較 Ray飛…

型変換

int → string String str = 50.ToString(); string → int int num = int.Parse("50"); bool → int using System; Convert.ToInt32(bool値); int → bool using System; Convert.ToBoolean(int値); int → float int a = 1; float b = (float)a; float → int fl…