Auto-generated authoring components' fields are not drawn with custom drawers.
Issue #868
new
With Unity DOTS, when authoring monobehaviour is auto-generated it gets attribute System.Runtime.CompilerServices.CompilerGenerated
as seen below.
[UnityEngine.DisallowMultipleComponent]
[global::System.Runtime.CompilerServices.CompilerGenerated]
public class OngoingActionCAuthoring : UnityEngine.MonoBehaviour, Unity.Entities.IConvertGameObjectToEntity
{
[Unity.Entities.RegisterBinding(typeof(OngoingAction_C), "Name")]
public Unity.Collections.FixedString128Bytes Name;
public void Convert(Unity.Entities.Entity __entity, Unity.Entities.EntityManager __dstManager, GameObjectConversionSystem __conversionSystem)
{
GoLCore.DecisionMaking.OngoingAction_C component = default(GoLCore.DecisionMaking.OngoingAction_C);
component.Name = Name;
__dstManager.AddComponentData(__entity, component);
}
}
If a custom drawer is defined for a type used in auto-generated monobehaviour as such:
public class FixedString128Drawer : OdinValueDrawer<FixedString128Bytes>
{
private string display;
private object key = new object();
protected override void DrawPropertyLayout(GUIContent label)
{
display = this.ValueEntry.SmartValue.ToString();
SirenixEditorGUI.BeginShakeableGroup(key);
display = SirenixEditorFields.TextField(label, display);
if(FixedString128Bytes.UTF8MaxLengthInBytes > display.Length)
{
this.ValueEntry.SmartValue = new FixedString128Bytes(display);
}
else
{
SirenixEditorGUI.StartShakingGroup(key);
}
SirenixEditorGUI.EndShakeableGroup(key);
}
}
it is ignored on the generated component and default drawer is applied.
If howerer the [global::System.Runtime.CompilerServices.CompilerGenerated]
attribute is removed, correct drawer is applied.
Expected behaviour is that custom drawers are used on auto-generated monobehaviours as well.
Unity version: 2021.3.6f1
Entities package: 0.51.0-preview.32
Editor Only Mode is disabled.