Hi, previously you could have a non uniform scale, but as of Entities 1.0.0 that is no longer possible, we are being told to use PostTransformScale instead. The way I understand is that whenever an entity has this component, it'll automatically be applied to its transform and be scaled.
I am currently working with a prefab which is supposed to scale based on a value of a component that it has.
I seem to have a couple of issues:
- My custom baker does not seem to add the
PostTransformScale - When editing the prefab such that it has a non uniform scale to begin with, it is properly added and edited - It is however not reflected visually although when inspecting the entity its
PostTransformScaleis being updated.
Baker class:
public class FoodSourceConverterBaker : Baker<FoodSourceConverter>
{
public override void Bake(FoodSourceConverter authoring)
{
var foodSource = new FoodSourceComponent
{
EnergyLevel = authoring.InitialEnergyLevel,
RegenarationRate = authoring.RegenerationRate,
MaxEnergyLevel = authoring.MaxEnergyLevel
};
AddComponent(foodSource);
AddComponent(new PostTransformScale { Value = float3x3.Scale(new float3(1, 1, 1)) });
AddComponent(new PropagateLocalToWorld());
}
}
Part of the systems OnUpdate() method:
// Let scale reflect energy level
Entities.WithAll<FoodSourceComponent, PostTransformScale>().ForEach((ref PostTransformScale scale, in FoodSourceComponent foodSource) =>
{
scale.Value = float3x3.Scale(new float3(1, foodSource.EffectiveSize, 1));
}).ScheduleParallel();
I am probably missing something stupid, but any help is appreciated!
