i'm having a small problem with entity spawning
i have an entity prefab and i Instantiate it in this way
but i get an expected behavior which the new entity appears at the location specified in the prefab before it transports to the new location i set down there
i expected this but have no idea how to fix it now
` Entity newUnit = state.EntityManager.Instantiate(currentItem.UnitPrefab);
RefRW<GameEntity> gameEntity = SystemAPI.GetComponentRW<GameEntity>(newUnit);
gameEntity.ValueRW.Team = factoryGameEntity.ValueRO.Team;
gameEntity.ValueRW.Owner = factoryGameEntity.ValueRO.Owner;
var position = factoryData.ValueRO.UnitSpawnPositionTransform;
state.EntityManager.SetComponentData(
newUnit,
LocalTransform.FromPosition(
localTransform.ValueRO.TransformPoint(position)));`
i tried changing the prefab's LocalTransform to the new location before Instantiating it using SystemAPI and state.EntityManager
i also tried using a command buffer and using playback but it still the same problem
SystemAPI.GetComponentRW<LocalTransform>(currentItem.UnitPrefab).ValueRW = LocalTransform.FromPosition( localTransform.ValueRO.TransformPoint(factoryData.ValueRO.UnitSpawnPositionTransform));