1. I want to generate an alert at a random time after an event has happened.

    I'm generating a random number but am unsure how I use that in the time with the appended f as in the example below:
    Code:
    timer.Once(3f, () =>
    {
        Puts("Hello world!")
    });
    Anyone know how I should do this?

    Thanks.
     
  2. Code:
    timer.Once(UnityEngine.Random.Range(1f, 3f), () =>
                {
                    //code
                });
    
    or:
    Code:
    var rng = UnityEngine.Random.Range(1f, 3f);
                timer.Once(rng, () =>
                {
                    //code
                });
    
     
  3. Wulf

    Wulf Community Admin

    That wouldn't handle the repeating though at a random time, just a timer after a random amount time. ;)
     
  4. Perhaps I misunderstood what he wanted, I was under the impression he just wanted a timer to fire (once) at a random interval.
     
  5. Yeah - it is just once per event. So this should be perfecto :)

    Thanks!