Smart Reference is a Unity plugin that enables lazy loading asset references in ScriptableObject and MonoBehaviour.
In Unity, referencing assets directly creates implicit dependencies.
When the MonoBehaviour or ScriptableObject is loaded, all referenced assets are loaded immediately, which can lead to slow startup times and unnecessary memory usage, especially in data driven projects.
Smart Reference solves this by allowing you to reference assets without loading them upfront, while keeping the same editor workflow. Assets are only loaded when you use them at runtime.
In the Inspector, SmartReference looks and behaves like a normal object reference.
using UnityEngine;
using SmartReference.Runtime;
public class MonsterData : ScriptableObject
{
public SmartReference<GameObject> prefab;
public SmartReference<Sprite> icon;
public string description;
}Choose the loader that matches your project setup.
using SmartReference.Runtime;
SmartReference.InitWithAddressablesLoader();using SmartReference.Runtime;
SmartReference.InitWithResourcesLoader();SmartReference.InitWithCustomLoader(new MyCustomLoader());Initialization must happen once, before any SmartReference is accessed.
var prefab = await monsterData.prefab.LoadAsyncUniTask();
Instantiate(prefab);var prefab = await monsterData.prefab.LoadAsyncTask();
Instantiate(prefab);monsterData.prefab.OnAsyncLoadComplete += go =>
{
Instantiate(go);
};
monsterData.prefab.LoadAsync();var prefab = monsterData.prefab.Load();
Instantiate(prefab);If you have questions or feedback:
- Leave an issue at GitHub Issues
- Leave a comment at Asset Store
- Email: bjjx1999@live.com
Thank you for your support!