All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Added the "Usage in Editor Code" section to README.
- Fixed mistakes in README.
SceneReferenceUnityEventAdapter
class: A utilityMonoBehaviour
that allows using statically providedSceneReference
s as parameters to aUnityEvent
.- Utility Ignores: A set of settings that allow ignoring certain scenes from having the inline utilities.
There are fundamental changes to the editor-time behaviour in this release. Please examine carefully before upgrading.
- From now on, map files are only generated during a build, and removed right after. In editor-time, maps are instead stored in and fetched from User Settings. You can remove the generated files and folders from your project, and remove the corresponding lines from your source control's ignore settings.
SceneDataMapsGenerator.Run
now takes a booelan argument that controls whether to ouput files or not.- Minimum compatible Unity version is set to
2020.3.48f1
.
- Default value of
EditorLogLevel
setting is nowWarning
, it was previouslyDebug
. - Default value of
JsonFormatting
setting is nowNone
, it was previouslyIndented
.
- Prevent null ref exceptions during runtime caused by uninitialized map providers when the maps are missing.
- Prevent
Scene GUID to path map file not found!
errors and null reference exceptions inSceneAssetPostprocessor
if the scene GUID to path map file is missing. - Prevent null reference exceptions at project launch due to addressables settings not being loaded yet.
- Ensure map files are always generated at editor startup, even if they are empty.
SceneReference.UnsafeReason
property: Provides the reasoning behind why aSceneReference
was deemed unsafe.SceneReferenceUnsafeReason
enum: Possible reasons for aSceneReference
to be deemed unsafe.
SceneDataMapsGenerator
no longer runs on scene saves.
- Prevent null reference errors when addressables package is installed, but addressables settings are not initialized.
- Backwards compatibility: Use
EditorStyles.miniButton
instead of non-existentEditorStyles.iconButton
for Unity versions earlier than 2022.1.
- Implemented workaround for a Unity bug that caused our settings page to throw exceptions and not display in Unity
2022.3.4f1
.
- Log level of the editor logger can now be controlled with the new setting
Logging/Editor Log Level
.
- Removed the suggestion to output generated files as indented for source control reasons. This is because we are suggesting to ignore the generated files.
This release introduces support for addressable scenes.
There are breaking changes to settings. Please visit the settings page and re-apply all your settings as soon as you update.
SceneGuidToPathMapGenerator
is renamed toSceneDataMapsGenerator
.SceneGuidToPathMapGenerationTriggers
is renamed toSceneDataMapsGeneratorTriggers
.- Settings changes:
- Scene GUID to Path Map (new name Scene Data Maps) category:
- The category is renamed from
SceneGuidToPathMap
toSceneDataMaps
. - Key of the
GenerationTriggers
setting is changed fromSceneGuidToPathMap.GenerationTriggers
toSceneDataMaps.GenerationTriggers
. - Key of the
JsonFormatting
setting is changed fromSceneGuidToPathMap.JsonFormatting
toSceneDataMaps.JsonFormatting
. - Key of the
FailBuildIfGenerationFails
setting is changed fromSceneGuidToPathMap.FailBuildIfGenerationFails
toSceneDataMaps.FailBuildIfGenerationFails
.
- The category is renamed from
- Property Drawer category:
ShowInlineSceneInBuildUtility
setting is renamed toShowInlineToolbox
. The key is also changed fromPropertyDrawer.ShowInlineSceneInBuildUtility
toPropertyDrawer.ShowInlineToolbox
.
- Scene GUID to Path Map (new name Scene Data Maps) category:
- All exceptions are moved from the
Eflatun.SceneReference
namespace to the newEflatun.SceneReference.Exceptions
namespace. - Following valiation properties are removed from
SceneReference
. They are instead replaced with a more informativeState
property. See the Added section.IsInSceneGuidToPathMap
: removed.IsInBuildAndEnabled
: removed.IsSafeToUse
: removed.HasValue
: no longer public.
SceneReferenceOptionsAttribute
changes:Coloring
field is renamed toSceneInBuildColoring
. It still controls the same cases of coloring, but they are no longer all the coloring options. See the Changes section.UtilityLine
field is removed. Its replacement is theToolbox
field. See the Added section.
SceneDataMapsGenerator
now also generates a scene GUID to address map. The map will be empty if addressables support is disabled.- New map generation triggers:
AfterPackagesResolve
: Triggers after packages are resolved.AfterAddressablesChange
: Triggers after addressable groups change.
- Property drawer can optionally color addressables scenes differently to draw attention to them.
- New inline utilties:
Make Addressable
: Makes the scene addressable.
- New settings:
- Addressables Support (
AddressablesSupport
) category:ColorAddressableScenes
setting: If enabled, scene references that have an addressable scene will be colored differently.- An info box that displays the current addressables support status.
- Addressables Support (
- New exceptions:
AddressNotFoundException
AddressNotUniqueException
AddressablesSupportDisabledException
SceneNotAddressableException
SceneGuidToAddressMapProvider
class: Provides a map of scene GUIDs to their address. Very similar toSceneGuidToPathMapProvider
, with the exception that it cannot provide an inverse map. This is because the address of an asset is not guaranteed to be unique. Instead, it providesGetGuidFromAddress
andTryGetGuidFromAddress
methods.SceneReference.FromAddress
factory method: Creates aSceneReference
from the given address.SceneReference.Address
property.SceneReference.State
property: This property replaces all previously exposed validation methods. It returns aSceneReferenceState
enum, which describes the state of theSceneReference
in terms of usage.SceneReferenceState
enum: Describes the state of theSceneReference
in terms of usage.Unsafe
: TheSceneReference
is not safe to use.Regular
: TheSceneReference
is safe to use, and it references a regular scene.Addressable
: TheSceneReference
is safe to use, and it references an addressable scene. This state is only possible if addressables support is enabled.
SceneReferenceOptionsAttribute
new fields:Toolbox
: Controls the visibility of the toolbox button. It replaces the now deletedUtilityLine
field.AddressableColoring
: Controls the coloring behaviour of the addressable scenes.
ToolboxBehaviour
enum. Replaces the now deletedUtilityLineBehaviour
enum with the same semantics.
- The concept of Utility Line is replaced with the concept of Toolbox. In summary, instead of drawing buttons as a second line below the field, we instead draw a small button to the end of the field on the same line. When clicked, a toolbox popup appears with all the utilities.
SceneInBuildColoring
argument (previously namedColoring
) ofSceneReferenceOptionsAttribute
still controls the same types of coloring cases, but since they used to be all the cases, the field was implicitly controlling the entire coloring behaviour. While its semantics are not changed, since there are now other coloring cases, it is no longer the only field that controls the entire coloring behaviour.
Open Build Settings
button to the scene-in-build utility popups. This button will ping the scene in the project view and open build settings, allowing you to fix your build settings manually.
Add to Build as Enabled
button is renamed toAdd to Build
in scene-in-build utility popups of scenes that are not in build.
Add to Build as Disabled
button in the scene-in-build utility popups of scenes that are not in build. This button was not making much sense because adding to build as disabled doesn't actually fix the situation, since the scene will still be disabled afterwards.
We renamed some of our internal serialized fields. Since we utilize FormerlySerializedAs
, you will not lose any data. However, due to these changes, Unity will re-serialize your SceneReference
s as you save your scenes and prefabs. Please commit these re-serialization changes as you see fit, otherwise they will keep appearing until you do so.
- Constructors and factory methods of
SceneReference
now validate their arguments and throw exceptions of typeSceneReferenceCreationException
if they are invalid. Note that the default constructor always creates an empty instance, but it never throws. - Changed the argument name of the constructor
SceneReference(string sceneAssetGuidHex)
toSceneReference(string guid)
. - Changed the name of the property
SceneReference.AssetGuidHex
toSceneReference.Guid
. - Changed the argument name of the factory method
SceneReference.FromScenePath(string scenePath)
toSceneReference.FromScenePath(string path)
.
SceneReference
now supports custom XML serialization viaSystem.Xml
.SceneGuidToPathMapProvider
now also provides a path to GUID map, which is inversely equivalent to the already existing GUID to path map.SceneReferenceCreationException
: Thrown when something goes wrong during the creation of aSceneReference
.
SceneReference
now implements serialization interfaces explicitly. This means serialization implementations are no longer exposed aspublic
.SceneReference
serialization implementations are nowvirtual
. This means child classes can override custom serialization behaviours.- Internal serialized field name changes:
SceneReference.sceneAsset
toSceneReference.asset
SceneReference.sceneAssetGuidHex
toSceneReference.guid
- Menu item
Tools/Eflatun/Scene Reference/Run Scene GUID to Path Map Generator
is renamed toTools/Eflatun/Scene Reference/Generate Scene Data Maps
.
- Prevent empty scene GUID hex in Unity serialized
SceneReference
instances. SceneReference
default constructor now initailizes with an all-zero GUID as intended.SceneReference
custom serialization implementations now guard against null or whitespace GUIDs.- Prevent Unity from throwing
InvalidOperationException: Stack empty.
after inline scene-in-build utility pop-up. - Internal bug fixes.
SceneReference
now exposes public constructors and a factory method for allowing instance creation in code:- Empty:
new SceneReference()
constructor - From GUID:
new SceneReference(string sceneAssetGuidHex)
constructor - (Editor-only) From asset:
new SceneReference(UnityEngine.Object sceneAsset)
constructor - From path:
SceneReference.FromScenePath(string scenePath)
factory method
- Empty:
- Add
UNITY_EDITOR
condition toUnityEditor
namespace import inSceneReference
.
- Added safeguard against situations where the scene GUID hex might be uninitialized.
- Support for custom serialization:
SceneReference
now implements theISerializable
interface and the corresponding deserialization constructor.
- Descriptive custom exceptions:
SceneReferenceException
: The root class of all custom exceptions of this package.EmptySceneReferenceException
InvalidSceneReferenceException
- Validation properties in
SceneReference
:IsSafeToUse
: Checks everything. Recommended for most use cases.HasValue
IsInSceneGuidToPathMap
IsInBuildAndEnabled
- Now throwing more descriptive custom exceptions (
EmptySceneReferenceException
andInvalidSceneReferenceException
) for edge cases.
- Use plaintext log prefixes (without styling) if outside Unity Editor.
- Improve performance of
[SceneReferenceOptions]
attribute lookup in the property drawer.
[SceneReferenceOptions]
attribute not being recognized when the field is nested in other serializables.
It is now recommended to ignore the generated map file in version control. See the new Ignore Auto-Generated Map File in Version Control section in README.md.
- Generator also generates a
.keep
file in the the auto-generated map folder to make sure the folder is always tracked in version control.
[SceneReferenceOptions]
attribute: Provides the ability to override scene-in-build validation settings on a per-field basis.
- Moved the whole
Eflatun/Scene Reference
menu to underTools
. The new resulting menu path isTools/Eflatun/Scene Reference
.
- Validation & inline fix utility for scenes that are either not in build or disabled in build.
- New settings entries for scene in build validation & inline fix utilities.
Initial release.