Eflatun.SceneReference
Unity Scene References for Runtime and Editor. Strongly typed, robust, and reliable. Provides GUID, Path, Build Index, Name, and Address.
Install / Use
/learn @starikcetin/Eflatun.SceneReferenceREADME
Installation
[!IMPORTANT]<br/> Minimum compatible Unity version is
2020.3.48f1.
Get Eflatun.SceneReference
With OpenUPM (recommended)
- Install
openupm-clivianpm. You can skip this step if already haveopenupm-cliinstalled.
npm install -g openupm-cli
- Install
com.eflatun.scenereferencein your project. Make sure to run this command at the root of your Unity project.
openupm add com.eflatun.scenereference
With Git URL
Add the following line to the dependencies section of your project's manifest.json file. Replace 4.1.1 with the version you want to install.
"com.eflatun.scenereference": "git+https://github.com/starikcetin/Eflatun.SceneReference.git#4.1.1"
Although it is highly discouraged, you can replace 4.1.1 with upm to get the latest version instead of a specific one.
Optional Dependencies
Addressables Support
Eflatun.SceneReference has support for addressables. It will be enabled or disabled automatically depending on whether you have the addressables package installed in your project. Please refer to the Addressables Package Documentation for information on how to install addressables package in your project.
[!NOTE]<br/> As a deliberate design decision in accordance with the Principle of least astonishment, the public API and settings that concern addressables will still be visible even if addressables support is disabled. This way, if you later decide to uninstall addressables from your project, you will not face an overwhelming amount of compiler errors. This enables you to transition between using and not using addressables with only a minimal amount of refactors.
Usage
- Define your
SceneReferenceserialized field:
// Import Runtime namespace
using Eflatun.SceneReference;
// You can define it by itself
[SerializeField] private SceneReference mySceneReference;
// Or in a collection
[SerializeField] private List<SceneReference> mySceneReferences;
- Assign your scene to your
SceneReferencefield in the inspector:

- Use it!
// Import Runtime namespace
using Eflatun.SceneReference;
// You can access these anytime, anywhere
var sceneGuid = mySceneReference.Guid;
var scenePath = mySceneReference.Path;
var sceneBuildIndex = mySceneReference.BuildIndex;
var sceneName = mySceneReference.Name;
// You can only access these when the scene is currently loaded
var loadedScene = mySceneReference.LoadedScene
// You can only access these if you have addressables support enabled
var sceneAddress = mySceneReference.Address;
Validation
You can check State property to make sure a SceneReference is completely valid before using it. It will also give you information regarding the type of the scene it references.
// Import Runtime namespace
using Eflatun.SceneReference;
if (mySceneReference.State == SceneReferenceState.Unsafe)
{
// The scene is not safe to use. Something is wrong.
}
if (mySceneReference.State == SceneReferenceState.Regular)
{
// The scene is safe to use. It references a regular scene.
}
// If you have addressables support enabled, you can also get this state:
if (mySceneReference.State == SceneReferenceState.Addressable)
{
// The scene is safe to use. It references an addressable scene.
}
If you need to know why a SceneReference is deemed unsafe, you can check the UnsafeReason property.
// Import Runtime namespace
using Eflatun.SceneReference;
if (mySceneReference.UnsafeReason == SceneReferenceUnsafeReason.None)
{
// All good. Safe to use.
}
if (mySceneReference.UnsafeReason == SceneReferenceUnsafeReason.Empty)
{
// mySceneReference is empty. It is not referencing anything.
}
if (mySceneReference.UnsafeReason == SceneReferenceUnsafeReason.NotInMaps)
{
// The scene referenced by mySceneReference is not found in any of the maps.
}
if (mySceneReference.UnsafeReason == SceneReferenceUnsafeReason.NotInBuild)
{
// The scene referenced by mySceneReference is not added and enabled in build.
}
[!IMPORTANT]<br/>
Emptyhas priority over all other reasons.NotInMapshas priority overNotInBuild.
Inline Inspector Utilities
A scene will be accessible in runtime only if one of the following is true:
- The scene is added and enabled in build settings.
- The scene is in an addressables group.
Eflatun.SceneReference on the other hand, allows you to assign onto it any scene you wish. This behaviour may cause runtime bugs when loading scenes. To prevent these potential bugs, Eflatun.SceneReference provides inline inspector utilities.
In this example:

Scene Afield is assigned a scene that is added and enabled in build settings. All good here.Scene Bfield is assigned a scene that is disabled in build settings.Scene Cfield is assigned a scene that is neither in build settings nor addressable.Scene Dfilds is assigned an addressable scene. Again, all good here.Scene Efield is not assigned anything. It is empty.- Similarly for the
Scene Reference Listproperty.
[!NOTE]<br/> Addressable scenes are only available if addressables support is enabled.
If we click on the little gear (⚙️) icon to the right of the field, a toolbox popup will open that contains the fix utilities. For Scene B field, we get the following tools:

And for Scene C field, we get the following tools:

[!NOTE]<br/> You will only see the
Make addressable...tool if addressables support is enabled.
Clicking on the Enable in build... button gives us this prompt:

Add to build... button gives the following prompt:

And Make addressable... button gives the following prompt:

Using these prompts, we can quickly alleviate the situation, and prevent potential runtime bugs when using these scenes.
Settings
Eflatun.SceneReference provides settings under the Project Settings.
Open the project settings via Edit/Project Settings... menu item.
Look for the Eflatun category in the left panel. Select the Scene Reference item.

Addressables Support
Settings regarding addressables support.
[!NOTE]<br/> Settings under this category are only relevant if addressables support is enabled.
Color Addressable Scenes
Should we color the property to draw attention for addressable scenes?
Addressable scenes should be handled differently than regular scenes in runtime, through the addressables API. Therefore, you would want quickly identify if an Eflatun.SceneReference references an addressable scene or not.
It is recommended to leave this option at 'true', as it will help you easily distinguish addressable scenes.
[!NOTE]<br/> This setting does not apply to regular scenes. They have their own coloring mechanism. It is controlled by the Color Based On Scene-In-Build State setting under the Property Drawer category.
Logging
Settings regarding logging.
[!NOTE]<br/> Exceptions will always be logged.
Editor Log Level
Log level for the editor logger. It is recommended to leave this at Warning.
Property Drawer
Settings regarding the property drawer.
Show Inline Toolbox
Should we show the inline gear (⚙️) button that opens a toolbox?
Unity only bundles scenes that are added and enabled in build settings, and addressables only pack scenes that are in an Addressable Group. Therefore, you would want to make sure the scene you assign to a SceneReference is either added and enabled in build settings, or is in an addressable group. The toolbox provides tools for you to quickly take action in these cases.
It is recommended to leave this option enabled, as the toolbox saves you a lot of time.
Color Based On Scene-In-Build State
Should we color the property to draw attention for scenes that are either not in build or disabled in build?
Unity only bundles scenes that are added and enabled in build settings. Therefore, you would want to validate whether the scene you assign to a SceneReference is added and enabled in build settings.
It is recommended to leave this option at 'true', as it will help you identify many potential runtime errors.
Related Skills
node-connect
340.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
340.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.2kCommit, push, and open a PR
