Scriptable Objects

CreateAssetMenu Attribute
// menuName: Path to the menu item
// fileName: Default name of the new file
// order: Priority of the menu item (100 is often reasonble)
[CreateAssetMenu(menuName = "VUdon - Vehicles/Data Presets/Car Spec Sheet", fileName = "NewCarSpecSheet.asset", order = 100)]
public class CarSpecSheet : ScriptableObject
{

}
Find all ScriptableObjects of type
// Use AssetDatabase.FindAssets to first get all of the GUIDs of the ScriptableObjects
string[] guids = AssetDatabase.FindAssets(string.Concat("t:", typeof(FootstepGroundTypePreset).Name));

// Then you can use language-integrated query's 'Select' operation to project the GUIDs to the desired ScriptableObjects
IEnumerable<FootstepGroundTypePreset> allPresets =
  guids.Select(guid => AssetDatabase.LoadAssetAtPath<FootstepGroundTypePreset>(AssetDatabase.GUIDToAssetPath(guid)));

// In short, you can do the following
IEnumerable<FootstepGroundTypePreset> allPresets =
  AssetDatabase.FindAssets(string.Concat("t:", typeof(FootstepGroundTypePreset).Name))
  .Select(guid => AssetDatabase.LoadAssetAtPath<FootstepGroundTypePreset>(AssetDatabase.GUIDToAssetPath(guid)));

Revision #3
Created 9 December 2022 19:46:09 by Varneon
Updated 23 July 2023 10:41:18 by Varneon