Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2011
    Posts
    2

    Random.RandomRange is obsolete?

    Hi everyone,

    I was wondering if someone could help me with a query. I have been following the tutorials to make the simple 2D Space Shooter in Unity. I'm stuck on video 12 - Creating the enemy.

    I am trying to make my 'enemy' move from the top of the screen, towards my 'Player', and then make it re-appear at the top, but in a new location. To do this I need to implement 'Random.RandomRange'. The problem I'm having is that I'm told that 'RandomRange' is obsolete. Has that happened to anyone, or am I just doing something wrong? If i am doing something wrong, does anyone know what the solution is?

    Thanks

    D

  2. #2
    Join Date
    Dec 2009
    Location
    United Kingdom
    Posts
    60
    Try Random.Range(float min, float max)

  3. #3
    Join Date
    Apr 2009
    Location
    Rochester, MN
    Posts
    179
    This should not be a problem. Its still implemented but just not what they say to use. Jason is using it in the video to stick as close to the Java code he is borrowing from. You'll see later when he does his own stuff he uses the proper range. So either you can switch to Random.Range or keep using Random.RandomRange to follow along exactly both will work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •