LoginSignup
1
2

More than 5 years have passed since last update.

デフォルト引数とデリゲートの危険

Posted at
kamosika.cs
private void kamosika(int pKamosika = 100)
{
 UnityEngine.Debug.LogError("kamosika!!!" + pKamosika);
}
Start ()
{
Action aaa = kamosika;
 aaa();
}

えー、Unityで上の様なコードを書くと
結果は
kamosiuka!!!-1675146973
になりました。

Monoの仕様なのかC#の仕様なのか・・・・
誰か詳しい人おしえて・・・

1
2
6

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2