Inspector display component bug

Started by k0fe · one year ago · 4 replies · 113 views

#1
k0fe
Member
JoinedAug 2023 Posts80 Score318
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.

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 );
    }
}
#2
garry
Facepunch
JoinedApr 2021 Posts436 Score2,270
Do they work again if you restart the editor?

Just trying to understand if it's a hotload bug or a deeper bug
#3
k0fe
Member
JoinedAug 2023 Posts80 Score318
Yeah, forgot to mention this, after restarting the engine everything works just fine 

#4
ziks
Facepunch
JoinedApr 2021 Posts6 Score455
Found the cause, working on a fix now.
delete
Deleted Post
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.