- edited description
SerializedScriptableObject with interface field and [AssetsOnly] issues
Issue #215
resolved
hi, I have defined some types below, then create an asset file of EventHub and an asset file of UnitDec. The EventHub.Next can be assigned by dragging an asset file, but cannot finish it in the poped up selecting window. If I select None in the poped up selecting window, I will get an error tip [see pic1 below], if I click the error, I will get another error tip [see pic2 below].
public interface IPublishEvent
{
event Action<int> OnEvent;
}
[CreateAssetMenu]
public class EventHub : SerializedScriptableObject, IPublishEvent
{
public event Action<int> OnEvent;
[AssetsOnly]
public IPublishEvent Next;
public void PublishEvent(int value)
{
OnEvent?.Invoke(value);
}
}
[CreateAssetMenu]
public class UnitDec : SerializedScriptableObject
{
[AssetsOnly]
public IPublishEvent UnitEvent;
}
pic1
pic2
Comments (4)
-
reporter -
reporter - edited description
-
- changed status to open
Hmm, we'll have to consider this possible case when deciding whether to display that error message. Thanks for the report!
For now, you can put the [SuppressInvalidAttributeError] attribute on your field, and that will hide the error message.
-
- changed status to resolved
- Log in to comment