weixin_43313892 2022-08-14 11:30 采纳率: 66.7%
浏览 231
已结题

unity Random无法使用

问题遇到的现象和发生背景

unity使用Random随机函数时

问题相关代码,请勿粘贴截图
using UnityEngine;
using Random = System.Random;

public class TestPoint : MonoBehaviour
{ 
    // Start is called before the first frame update
    void Start()
    {
        float fl = Random.value; 
    } 
}
运行结果及报错内容

Cannot resolve symbol 'value'
unity引用是正常的,可以看到Vector3等unity系统变量都正常。

我想要达到的结果

img

img

Random.value 随机数为什么我无法使用,不明白请解惑,万法感谢!

  • 写回答

2条回答 默认 最新

  • kakaccys 2022-08-14 11:52
    关注

    你把这句using Random = System.Random;
    给删除了,不需要这句话,这句话引用到其他地方了。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 11月24日
  • 已采纳回答 11月16日
  • 请采纳用户回复 8月24日
  • 创建了问题 8月14日