Inspector display component bug

Started by k0fe 5 posts 112 views

Reply on sbox.game
  1. #1
    k0fe 318
    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 );
        }
    }
  2. #2
    garry Facepunch 2,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. #3
    k0fe Started this 318
    Yeah, forgot to mention this, after restarting the engine everything works just fine 

  4. #4
    ziks Facepunch 455
    Found the cause, working on a fix now.
  5. #5
    Unknown