How can one place light probes in the scene using an editor script

I’m trying to find a faster method to put light probes in a scene without having to place each probe manually in the editor.

One approach was to use any mesh from any object (usually a plane) to put probes in each vertex position of the mesh.

It seems that the LightProbeGroup’s property probePositions cannot be modified or it doesn’t have any effect on the positions of the probes in the scene.

Is there any way to do this or the only possible way to place light probes in the scene is by hand ?

Here is my code, much obliged to anyone who can point out my wrong-doing here :slight_smile:

using UnityEditor;
using UnityEngine;
public class PlaceLightProbesOnVertices : ScriptableWizard
{
    public GameObject theObjectWithVertices;
    public LightProbeGroup lpg;
    [MenuItem("Custom/Place LightProbes On Every vertex of the mesh")]
    static void DoSet()
    {
        ScriptableWizard.DisplayWizard("Place LightProbes On Every vertex of the mesh", typeof(PlaceLightProbesOnVertices), "GO");
    }
    void OnWizardCreate()
    {
        Mesh mesh = theObjectWithVertices.GetComponent<MeshFilter>().sharedMesh;
        lpg.probePositions = new Vector3[mesh.vertexCount];
        for (int i = 0; i < mesh.vertexCount; i += 1)
        {
            lpg.probePositions[i] = mesh.vertices[i];
        }
    }
}

Hi, I just recently had a similar problem and wrote a little editor tool to help me place light probes quicker. It does not provide automation but it’s at least 10x quicker.

Hope it helps!

There’s a script available on the Asset Store called “Light Probe Region Tool”. It allows you to set a region for your lightprobes via script. You can control the area and density of the light probes, and make sure everything is lit evenly without going through the tedious process of setting them by hand.

It’s $5 from LOOT Entertainment.

Best of luck with lighting your game!