Hi thanks for this library - trying to use it organise Unity Atoms - starting with Events but probably move on to Variables, Actions, Conditions etc.
I have classes derived from your library with Generics
public class AtomEventCollection<T> : ScriptableObjectCollection<AtomEventItem<T>>
{ }
public abstract class AtomEventItem<T> : ScriptableObjectCollectionItem
{
[SerializeField]
private AtomEvent<T> _event;
public AtomEvent<T> Event
{
get { return _event; }
set { _event = value; }
}
.... this also automatically generates the AtomEvent<T> on creation and nests it under the CollectionItem
public class AtomEventIndirectReference<T> : CollectionItemIndirectReference<AtomEventItem<T>> {
public AtomEventIndirectReference() {}
public AtomEventIndirectReference(AtomEventItem<T> collectionItemScriptableObject) : base(collectionItemScriptableObject) {}
}
which then get made concrete like
public partial class WorldGameEvent : AtomEventItem<World> { }
public class WorldGameEventCollection : AtomEventCollection<WorldGameEvent> { }
As far as I can tell at this stage this is working.
In order to get this working I've had to make the following edit on line 226 of ScriptableObjectCollection.cs
` // DOESN'T WORK -> if (baseType.IsGenericType && baseType.GetGenericTypeDefinition() == typeof(ScriptableObjectCollection<>))
if (baseType.IsGenericType) // edit mgmhunt`
as it's presuming the Generics are only the ScriptableObjectCollection<>. I couldn't get IsSubClass of (probably to do with Generics again - maybe you've got a cleaner way of fixing this?)
My question is do you foresee issues down the road with this as I'm hoping this library will be broadly useful and not sure what this assumption my cause with other classes?
----- Working so far ----
WorldGameEvent testWorldEvent;
testWorldEvent.Event.Observe().TakeUntilDisable(this).Subscribe(_ => { LoadWorld(defaultWorld); }).AddTo(_subscriptions);
testWorldEvent.Event.Raise();