13 Replies
this is a 2d game
do i need to import anything like in python i.e., import random
What's the error it's showing?
Unity is different from regular .NET
you should be referring to Unity specific randomness, since .NET's doesn't directly apply here, https://docs.unity3d.com/ScriptReference/Random.Range.html
what
sorry i have no clue what that means XD what is .NET
it says cannot declare a variable of static type "Random"
Please read the page i linked you, it has an example as well.
So i use random.range?
Random is a static class. This means, among other things, that you can't create variables which have the type
Random
, and you can't do new Random()
.i got the code online
you should use the single instance of
Random
unity has implemented, yes
as per their instructionsalr thanks ill try change it
You likely got the code from somewhere outside the context of Unity. Unity is very different from 'regular' C#.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.