ScriptableObjectManager#
- NAMESPACE:
UnityUtils.ScriptUtils.ScriptableObjects
Note
Make sure your Scriptable Objects are somewhere within the ‘Resources’ folder in ‘Assets’ (If you don’t have a ‘Resources’ folder, create one).
The ScriptableObjectManager is used to easily grab scriptable objects from a location in the Unity file system.
Example Usage#
using UnityEngine;
using UnityUtils.ScriptUtils.ScriptableObjects;
public class ExampleScript : MonoBehaviour
{
void Start()
{
// Grabs all scriptable objects in the 'Assets/Resources/Weapons folder' and sub folders
// (Example 'Weapon' class)
Weapon[] weapons = ScriptableObjectManager.GetScriptableObjects("Weapons");
// Grabs all scriptable objects in the 'Assets/Resources/Weapons/Guns' folder and sub folders
// (Example 'Gun' class)
Gun[] guns = ScriptableObjectManager.GetScriptableObjects("Weapons/Guns");
}
}
Functions#
- UnityUtils.ScriptUtils.ScriptableObjects.ScriptableObjectManager
Public Static Functions
- T[] GetScriptableObjects< T > (string path)
Gets an array of ScriptableObject found in [Resources/’path’]. Make sure you have a ‘Resources’ folder created.
- Parameters:
path – file path to where ScriptableObject are held (found in [Resources/’path’]
- Returns:
Array of specified scriptable object classType