A persistent GameObject reference palette with automatic prefab variant creation
for the Unity Editor by BigBuffaloBill.
Author's Note on Expected Functionality: The author has written an important note about the intended scope, known limitations, and support expectations for this toolset. Please see Notes on Tool Intent, Status and Author Support before proceeding.
Object Reference Manager is a Unity Editor extension that gives you a dedicated window for storing, organizing, and reusing GameObject references across your project. Instead of hunting through deep folder hierarchies or losing track of frequently used assets, you can keep them all in one dockable panel — complete with 64×64 thumbnail previews — and drag them directly into your scenes.
What sets Object Reference Manager apart is its automatic prefab variant workflow. When you drag a scene object into the manager, it detects that the object is not yet a persistent asset and automatically creates a prefab variant in a dedicated Prefabs subfolder. This means you never accidentally store a reference to a transient scene object that would break the next time you reload. Every reference in the manager is guaranteed to point to a real, saved asset.
The tool stores all its data in a single ScriptableObject asset, so your reference list persists across Editor sessions, domain reloads, and even source control operations. It uses self-resolving asset paths — the window locates its own data files at runtime based on where the script is installed, so it works regardless of where you place it in your project and is fully compatible with symlinks and custom folder structures.
MonoScript.FromScriptableObject to locate its own install directory at runtime; no hardcoded paths, fully symlink-safePrefabUtility.SaveAsPrefabAsset, AssetPreview.GetAssetPreview, and MonoScript.FromScriptableObject, all available since 2018.4+; tested and recommended on 2020.3+)UnityEngine, UnityEditor, System.IO)Allow Unity to compile the newly imported scripts. Once compilation finishes, the tool is ready to use — no additional setup is required. The following assets will be present in your project:
Assets/BBB/ObjectReferenceManager/
├── Editor/
│ └── ObjectReferenceManager.cs
├── ObjectReferences.cs
├── ObjectReferenceManagerData.asset (created automatically if missing)
└── Prefabs/ (created automatically on first use)
Note: The
ObjectReferenceManagerData.assetfile and thePrefabs/folder are created automatically the first time you open the manager window. You do not need to create them manually.
Navigate to Tools > BBB > Object Reference Manager in the Unity menu bar. The window is a standard dockable Editor window — you can dock it alongside the Inspector, Scene view, or any other panel. The window title is “Object Reference Manager.”
At the top of the window, you will find a Resize Array button and an integer input field.
Important: Resizing clears all existing references in the array. This is by design to prevent index confusion. If you need to preserve existing references, note them before resizing.
The minimum array size is 0. Negative values are automatically clamped to 0.
Each array slot displays an element index label, a selection checkbox, a 64×64 thumbnail preview area, and a standard Unity ObjectField.
Adding project assets: Drag any GameObject prefab from the Project window into the ObjectField for a slot. The reference is stored directly.
Adding scene objects: Drag a GameObject from the Hierarchy into the ObjectField. The manager automatically:
EditorUtility.IsPersistent).PrefabUtility.SaveAsPrefabAsset.<ObjectName>_Variant_<SlotIndex>.prefab (with automatic unique path generation to avoid naming collisions).This conversion happens automatically every GUI update cycle, so any scene object reference is converted as soon as it appears in the array.
Each slot displays a 64×64 thumbnail of the referenced asset (generated by Unity’s AssetPreview.GetAssetPreview). While the preview is loading, a “...” placeholder is shown. Empty slots display “Empty.”
To drag an object out of the manager:
The drag operation uses Unity’s standard DragAndDrop API, so it is compatible with all standard Editor drop targets.
Checkbox selection: Each row has a checkbox to the right of the element label. Check one or more rows to select them.
Clear Selected: Click the Clear Selected button to set all checked slots to null. The checkboxes are also cleared.
Clear All: Click the Clear All button to set every slot in the array to null and clear all checkboxes.
Right-click context menu: Right-click on any thumbnail preview to open a context menu. If the slot contains an object, the menu shows a Clear Object option that sets that slot to null. If the slot is empty, the option is grayed out.
Note: Clearing a reference removes it from the manager only. The underlying prefab asset in the Prefabs folder is not deleted.
All references are stored in ObjectReferenceManagerData.asset, a ScriptableObject asset located in the same directory as the ObjectReferenceManager package. This file:
The manager marks the data asset as dirty on every GUI update, ensuring that changes are included in the next asset save operation.
Prefab variants created by the manager are saved to a Prefabs/ subfolder within the package install directory. The naming convention is:
<OriginalObjectName>_Variant_<SlotIndex>.prefab
If a file with that name already exists, Unity’s AssetDatabase.GenerateUniqueAssetPath appends a numeric suffix to ensure uniqueness (e.g., Tree_Variant_0 1.prefab).
These prefab assets are standard Unity prefabs and can be used, moved, or deleted independently of the manager.
Namespace: Global (no namespace)
Inherits: UnityEditor.EditorWindow
Location: Editor/ObjectReferenceManager.cs
Description: The main Editor window class. This is an editor-only class and is not available at runtime.
| Menu Path | Method | Description |
|---|---|---|
| Tools > BBB > Object Reference Manager | ShowWindow() |
Opens or focuses the Object Reference Manager window. |
These methods are not part of a public API but are documented here for reference and extensibility:
| Method | Description |
|---|---|
OnEnable() | Resolves asset paths from the script’s own location using MonoScript.FromScriptableObject, then loads or creates the data asset. |
OnGUI() | Draws the window GUI, applies serialized property changes, runs the scene-to-prefab conversion pass, and marks data dirty. |
DrawCustomArrayField() | Renders the resize controls, Clear Selected / Clear All buttons, and the per-element rows with checkboxes, thumbnails, and ObjectFields. |
DrawDragIcon(int index) | Renders the 64×64 thumbnail for a slot and handles left-click drag-out initiation, right-click context menus, and mouse state tracking. |
ClearObjectAtIndex(int index) | Sets data.gameObjects[index] to null and refreshes the serialized state. |
ClearSelected() | Nullifies all checked slots and clears their checkboxes. |
ClearAll() | Nullifies every slot and clears all checkboxes. |
ResizeArrayWithWarning() | Shows a confirmation dialog, then resizes and clears the array if the user confirms. Clamps negative sizes to 0. |
ConvertSceneObjectsToPrefabs() | Iterates the array and converts any non-persistent (scene) GameObjects into prefab assets via CreatePrefabVariant. |
HandleDragAndDrop(Rect, int) | Processes DragUpdated and DragPerform events for accepting external drag-and-drop into individual slots. |
CreatePrefabVariant(GameObject, int) | Creates the Prefabs directory if needed, generates a unique asset path, saves the scene object as a prefab via PrefabUtility.SaveAsPrefabAsset, and returns the new prefab asset. |
Namespace: Global (no namespace)
Inherits: UnityEngine.ScriptableObject
Location: ObjectReferences.cs
Description: A minimal ScriptableObject that holds the persistent array of GameObject references.
| Field | Type | Default | Description |
|---|---|---|---|
gameObjects |
GameObject[] |
new GameObject[0] |
The array of stored GameObject references. Each element can be null (empty slot) or a reference to a prefab or other persistent GameObject asset. |
Type: Serialized ObjectReferences ScriptableObject
Location: Same directory as the package root (auto-created if missing)
Description: The persistent data store. This YAML-serialized asset contains the gameObjects array with Unity object references (fileID + GUID pairs). It can be version-controlled normally.
Organize by purpose. Use separate array regions for different categories — for example, slots 0–9 for vegetation, 10–19 for props, 20–29 for UI elements. The element index labels make it easy to maintain a mental map.
Pre-size your array. Decide on a slot count before you start populating references. Resizing clears all data, so it’s better to allocate extra empty slots upfront than to resize later.
Use the thumbnails for dragging. The thumbnail preview area is the designated drag source. Click and drag from the thumbnail image to place objects in your scene. The ObjectField itself is for assigning references, not for dragging out.
Let the auto-conversion work for you. You don’t need to manually create prefabs before adding scene objects. Just drag objects from the Hierarchy and the manager handles prefab creation automatically. The generated prefabs appear in the Prefabs subfolder.
Version control the data asset. The ObjectReferenceManagerData.asset file and the Prefabs/ folder should be committed to your repository so that all team members share the same reference palette.
Relocate freely. Because the tool resolves its own paths at runtime, you can move the entire package folder to a different location in your project without breaking anything. Just let Unity reimport after moving.
Check debug logs for issues.
Q: I resized the array and lost all my references. Can I undo?
A: The resize operation shows a warning dialog before proceeding. If you confirmed the resize, the previous data is overwritten. Unity’s Undo system does not cover this operation. It is recommended to note your current references before resizing or to keep your data asset under version control so you can revert.
Q: The thumbnail shows “...” instead of a preview image.
A: Unity generates asset previews asynchronously. The “...” placeholder appears while the preview is loading. The preview will appear after a moment, or after the window is repainted. If it persists, try clicking away and back, or reimporting the asset.
Q: A slot shows “Empty” even though I dragged something in.
A: If you dragged a scene object and the prefab creation failed (for example, due to a write permission issue in the Prefabs folder), the slot may revert to null.
Q: Where are the auto-generated prefabs saved?
A: In a Prefabs/ subfolder within the Object Reference Manager’s install directory. For example, if the package is at Assets/BBB/ObjectReferenceManager/, the prefabs are at Assets/BBB/ObjectReferenceManager/Prefabs/.
Q: Can I delete the auto-generated prefabs?
A: Yes. They are standard Unity prefab assets. However, if the manager still references a deleted prefab, that slot will show a “Missing” reference. Clear the slot using the right-click context menu or the Clear buttons.
Q: I moved the package folder and the data is gone.
A: The data asset (ObjectReferenceManagerData.asset) must remain in the same directory as the package root. If you moved the folder, the data asset moved with it and the tool will find it at the new location on next open. If you moved only the Editor script without the data asset, the tool will create a new empty data asset. Move all files together to preserve data.
Q: Can I use this at runtime?
A: No. Object Reference Manager is an Editor-only tool. The ObjectReferenceManager class is in an Editor folder and depends on UnityEditor APIs that are not available in builds. The ObjectReferences ScriptableObject can technically be accessed at runtime, but the manager itself cannot.
Q: Does this work with Unity’s Addressables or asset bundles?
A: The manager stores direct object references (GUID-based). It does not integrate with Addressables or AssetBundle systems. You can still use the manager to organize your references, but the stored references are standard Unity asset references, not addressable keys.
For questions, bug reports, or feature requests, please contact us through the Dicord Channel linked below.
Publisher: BigBuffaloBill
Discord: BigBuffaloBill & Friends Gaming + (bbb-unity-support-forum-public)