Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

unity value or random.initstate

Discussion in 'Scripting' started by Tempest74, Mar 15, 2018.

  1. Tempest74

    Tempest74

    Joined:
    May 17, 2017
    Posts:
    133
    Code (CSharp):
    1. if (seed != 0)
    2.             Random.InitState(seed);
    3.         Debug.Log (Random.state);
    Is there a way to find the state(seed) allocated to random function? my code doesn't seems to work. I have the next output:
    UnityEngine.Random+State
    UnityEngine.Debug:Log(Object)
    RoomGenerator:Start() (at Assets/_Scripts/RoomGenerator.cs:50)
     
  2. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    You're setting the seed, so you know what the value is. Why do you need to find later?
     
  3. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    9,900
  4. Tempest74

    Tempest74

    Joined:
    May 17, 2017
    Posts:
    133
    Yes, but if my seed is 0 i want the default value