D
D
d1for2020-04-26 23:54:01
C++ / C#
d1for, 2020-04-26 23:54:01

How can I make it so that I can write random.range?

Colleagues, good evening!

Tell me, please, I downloaded the tutorial on working in Unity, but in the process a question arose, the lecturer enters "int index = Random.Range", and then the values, and when I start to enter, it gives an error, I attach screenshots, help) 5ea5f46e109f4149161471.pngThis is what gives me , but here is what the lecturer 5ea5f4c13b54f511621345.pngsuggests to enter range, I don’t have (

Answer the question

In order to leave comments, you need to log in

1 answer(s)
2
2CHEVSKII, 2020-04-27
@2chevskii

Probably because he uses UnityEngine.Random and you use System.Random.
Decision:

using System; // удаляем
using UnityEngine; // добавляем

If you still need the included System namespace, then you can either specify the type along with the namespace in the call: Or use a more elegant one: Don't forget to mark as a solution.
int index = UnityEngine.Random.Range(1,2);
using Random = UnityEngine.Random;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question