Sebastian Lague's Poisson Disc Sampler

Hello everyone this is my first question in the forum.

I was trying to implement the Poisson Disc Sampler from one of the great Sebastian Lague tutorials found here

in my project, I simply copied the PoissonDiscSampling.cs class

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public static class PoissonDiscSampling {

    public static List<Vector2> GeneratePoints(float radius, Vector2 sampleRegionSize, int numSamplesBeforeRejection = 30) { ...}
        

    static bool IsValid(Vector2 candidate, Vector2 sampleRegionSize, float cellSize, float radius, List<Vector2> points, int[,] grid) { ...}
}

I tried to implement this in a Start function, but it’s only working for OnValidate(), in the tutorial he is using OnValidate to change parameters on the fly in the inspector to see the behaviour. I don’t understand why it works for OnValidate() and it’s not working for Start(). If someone could explain the reason for this issue please explain below :slight_smile:

Thanks in advance

I got my answer, it was quite easy, I just wasn’t giving the correct parameters when using start

1 Like