以下の内容はhttps://indie-du.com/entry/2020/12/15/110717より取得しました。


Unity : Randomを使うとエラーが出る場合の解決方法

Random.Range 関数でランダム値を取得しようとすると以下のようなエラーが出る場合があります。

error CS0104: 'Random' is an ambiguous reference between 'UnityEngine.Random' and 'System.Random'
error CS0104: 'Random' is an ambiguous reference between 'Unity.Mathematics.Random' and 'UnityEngine.Random'

これは複数の名前空間に Random クラスが定義されているのでコンフリクトが起きているせいです。

以下のようなかんじでC#スクリプトの先頭にどこのRandomを使うか明記すればエラーは消えます。

using Random = UnityEngine.Random;



以上の内容はhttps://indie-du.com/entry/2020/12/15/110717より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14