Cysharp / R3

The new future of dotnet/reactive and UniRx.
MIT License
2.25k stars 98 forks source link

SerializedReactiveProperties Odin Inspector support #257

Open devcube9 opened 2 months ago

devcube9 commented 2 months ago

Thank you for developing this amazing framework.

Currently, when using SerializedReactiveProperties with Odin inspector, there is an error when changing their values in the inspector.

https://github.com/Cysharp/R3/blob/2eaf201aabbbcb8d84c447cdd29201e457a4472a/src/R3.Unity/Assets/R3.Unity/Runtime/SerializableReactiveProperty.cs#L70

Similar issues was found in UniRx here:

https://github.com/neuecc/UniRx/pull/531 https://github.com/neuecc/UniRx/pull/452

Unlike the issues in UniRx, fieldInfo is null in R3

neuecc commented 2 months ago

thanks, I'll check it.

neuecc commented 1 month ago

I've tested at Unity 6000.0.20f1 and Odin 3.3.1.8, maybe it works. Can you check it for me? Also, I would be grateful if you could provide the MonoBehaviour code for the case where it doesn't work.

devcube9 commented 3 weeks ago
using R3;
using Sirenix.OdinInspector;
using UnityEngine;

class Test {
    [SerializeField] private SerializableReactiveProperty<int> reactiveProperty;
}

public class SerializableReactivePropertyOdinError : SerializedMonoBehaviour {

    [SerializeField] private Test test;

}

I tested again and found that it only throws an error when a SerializableReactiveProperty is nested inside a class

neuecc commented 3 weeks ago

thanks, I'll check it again.