Sigh. I HATE these moments. I don’t know why, but now It works. ¯_(ツ)_/¯
This works, for what it’s worth considering the source
float3 position = new float3(1985, layer, -1200);
var localTransform = LocalTransform.FromPositionRotation(position, quaternion.identity);
entityCommandBuffer.SetComponent(entity, localTransform);
Ok,
Welcome back to “James is doing something stupid”
I have narrowed down the problem I have when I instantiate some objects when the game starts.
int index = randomComponent.ValueRW.random.NextInt(0, trafficSpawnerComponent.Length);
Entity spawnedEntity = EntityManager.Instantiate(trafficSpawnerComponent.ElementAt(index).prefab);
float3 position ;
position.y = 70;
position.z = -1200;
position.x = 1985;
var localTransform = LocalTransform.FromPositionRotation(position, quaternion.identity);
//ANY OF THESE CAUSE THE ENTITY TO DISAPPEAR
//entityCommandBuffer.SetComponent(spawnedEntity, new LocalTransform { Position = position }); //entityCommandBuffer.SetComponent(spawnedEntity, localTransform);
//entityCommandBuffer.SetComponent(spawnedEntity, new LocalTransform { Position = position, Rotation = new quaternion(), Scale = 1.0f });
Within the Entities Hierarchy the entity’s values are visible and set correctly:
This is a simple sphere and unlit material. Again, if I run this without attempting to set its position, the entity is visible in game and scene views.
So… what dumbass thing am I doing wrong?
Thanks