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 ![]()
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];
}
}
}