GenericUnityObjects icon indicating copy to clipboard operation
GenericUnityObjects copied to clipboard

Using Resources.LoadAll

Open Navil opened this issue 1 year ago • 2 comments
trafficstars

Hey,

pretty much new to this package (and C#, but not programming itself). I have that usecase where I need my SO to be generic, but Unity does not really allow that. As I tried setting up an event driven Architecture, where each Ability is tied to a specific CombatEvent (e.g. StartOfRound, OnAttack, ...), I tried the following signature: public abstract class AbilityData<T> : GenericScriptableObject where T: CombatEvent

However, calling Resources.LoadAll<AbilityData<CombatEvent>>("Abilities") does not yield me any results. Is there any replacement function to be used, so.I can load all my GenericScriptableObjects from a folder?

Navil avatar Mar 17 '24 19:03 Navil

@Navil Do you have your GenericScriptableObject assets in a Resources folder (or subfolder of that)?

CraigGraff avatar Mar 25 '24 22:03 CraigGraff

Yes, I do. It is working if I use normal ScriptableObjects and remove the generic elements.

Navil avatar Mar 26 '24 11:03 Navil