"Trying to update the managed reference registry with invalid propertyPath" error with inheriting ability

Cheo

Active member
Hello, I'm trying to make a custom Interact ability that inherits from the default one, the only parameter added sor far is an angle check between the player's forward direction and the Interactable's. Here is how it looks like :

C#:
using Opsive.UltimateCharacterController.Character.Abilities;
using Opsive.UltimateCharacterController.Utility;
using UnityEngine;

[DefaultStartType(AbilityStartType.ButtonDown)]
[DefaultInputName("Action")]
[DefaultAbilityIndex(9)]
[DefaultAllowPositionalInput(false)]
[DefaultAllowRotationalInput(false)]
[AllowDuplicateTypes]
public class MyInteract : Interact
{
    [SerializeField] protected bool m_UseInteractionAngle;
    public bool UseInteractionAngle { get { return m_UseInteractionAngle; } set { m_UseInteractionAngle = value; } }
    [SerializeField] protected float m_InteractionAngle = 30;
    public float InteractionAngle { get { return m_InteractionAngle; } set { m_InteractionAngle = value; } }

    public override bool CanStartAbility()
    {
        // The base class may prevent the ability from starting.
        if (!base.CanStartAbility())
        {
            m_Interactable = null;
            return false;
        }

        // The ability can't start if the Interactable isn't ready.
        if (m_Interactable == null || !m_Interactable.CanInteract(m_GameObject))
        {
            return false;
        }

        if (m_UseInteractionAngle && Vector3.Angle(m_CharacterLocomotion.transform.forward, m_Interactable.transform.forward) > InteractionAngle)
        {
            return false;
        }

        return true;
    }
}

However when ticking this ability on and off, or simply adding it or pressing play i get this error : "Trying to update the managed reference registry with invalid propertyPath(likely caused by a missing reference instance)'managedReferences[3314582431490637826].m_Enabled', with value '0'".
I tried testing with an empty script containing only the inheritance and gradually added the rest but got incoherent results with both scripts, I sometimes got the error and sometimes didn't. Could someone please give it a try and tell me if I'm doing anything wrong here ? I'm using Unity 2022.2.9 if that changes anything. Thanks in advance.
 
Damn it, this really sucks, I don't intend to revert to the latest LTS, I think I'll just stick to my previous solution which was to create a full copy of Interact. Thanks for your answer.
 
Top