Closed laurentopia closed 1 month ago
Hi,
Correct me if I'm wrong: SerializeReference
does not work with a pure Interface
.
A way to do it is SaintsInterface
. See related document for more information.
public class MCPhysicsRelay: MonoBehaviour
{
public SaintsInterface<UnityEngine.Object, IPhysicsReceiver> receiver1;
// For old Unity, inherit to a non-generic class first
[Serializable]
public class PhysicsReceiverInterface : SaintsInterface<UnityEngine.Object, IPhysicsReceiver> { }
public PhysicsReceiverInterface receiver2;
// this also works with the GetComponent* decorators
[GetComponentInChildren] public PhysicsReceiverInterface receiver3;
// at this point it does not work with `RequireType` but I'm working on it
private void Awake()
{
Debug.Log(receiver3.I); // get the actual interface
}
}
Hi, this issue is closed as answered. If you still have related issue, please comment below and I'll open it again
Is this possible?
I'm getting that
![image](https://github.com/TylerTemp/SaintsField/assets/26075468/6aeb7a37-5672-45c6-a3d6-2b8f8da574a2)