Light probes usage issue

Hi, I’ve got big issue with entities which I created.
As you can see in screenshot below : white models are entites generated at runtime, textured ones are standard models with lightprobes usage off.
I have a main scene and a second scene loaded in additive, both with own lighting setup. Entites are created in scene B when loaded.

My code to create entites :

_entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
            _entityArchetype = _entityManager.CreateArchetype(
                typeof(Translation),
                typeof(RenderMesh),
                typeof(RenderBounds),
                typeof(LocalToWorld)
            );
_entityManager.CreateEntity(_entityArchetype, _entityArray);

                    AABB aabb = new AABB();
                    aabb.Extents = new float3(0.5f, 0.1f, 0.1f);
                   
                    _entityManager.SetComponentData(_entityArray[0],
                                                    new Translation {Value = obj.objPos});

                    _entityManager.SetComponentData(_entityArray[0],
                                                    new RenderBounds {Value = aabb});

                    _entityManager.SetSharedComponentData(_entityArray[0],
                                                          new RenderMesh
                                                          {
                                                              mesh = Resources.Load<Mesh>(
                                                                  levelsFolderPath + _currentSceneName + "/Models/" +
                                                                  obj.meshName),
                                                              material = Resources.Load<Material>(
                                                                  levelsFolderPath + _currentSceneName + "/Materials/" +
                                                                  obj.meshMaterials[i]),
                                                              subMesh  = i,
                                                              layer    = 9
                                                          });

I’m stuck, I dont know how to deal with this issue.

Make sure you’re calling
https://docs.unity3d.com/ScriptReference/LightProbes.Tetrahedralize.html

after scene has been loaded. Otherwise probes from that scene will not be used.

1 Like