コガネブログ

平日更新を目標に Unity や C#、Visual Studio、ReSharper などのゲーム開発アレコレを書いていきます

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

【C#】InvalidCastException: Cannot cast from source type to destination type.

概要 InvalidCastException: Cannot cast from source type to destination type. object型の変数をキャストした時に遭遇 例えば下記のようにint型の値をobject型の変数に代入して 取り出す時に直接float型など別の型にキャストしようとすると発生 int x = 1…