So I was testing the engine and having fun when suddenly inspector stopped displaying new components in
Edit mode. I am not sure what could be the reason as I've spent around 2 hours in engine at that moment.
When it started:
After adding generics to the components my inspector stopped adding said components.
Play this video on YouTube
Base class code
public class ConstraintsBase<T> : Component
{
[Property] public bool IsActive { get; set; } = true;
[Property, MinMax(0, 1)] public float Weight { get; set; } = 1.0f;
[Property] public GameObject Target { get; set; }
[Property] public ConstraintsSettingsBase<T> Settings { get; set; } = new();
protected override void OnUpdate()
{
if ( !IsActive ) return;
OnConstraintUpdate();
}
public virtual void OnConstraintUpdate()
{
}
}
public class ConstraintsSettingsBase<T>
{
public T Offset { get; set; }
}
Attached component code
public class PositionConstraints : ConstraintsBase<Vector3>
{
public override void OnConstraintUpdate()
{
base.OnConstraintUpdate();
WorldPosition = Vector3.Lerp( WorldPosition, Target.WorldPosition + Settings.Offset, Weight );
}
}