I am new to unity addressables and would like to load a scene with an AssetReference. To enforce AssetReferences being a scene, I created the following class in a utility assembly:
using System;
using UnityEngine;
using UnityEngine.AddressableAssets;
[Serializable]
public sealed class SceneReference : AssetReferenceT<SceneAsset>
{
public SceneReference(string guid) : base(guid) { }
}
JetBrains Rider then said SceneAsset had to be referenced from assembly: UnityEditor.CoreModule
. I used its suggestion, and Rider automatically set up the
assembly reference. Everything worked great, and indeed I could only drag scenes into a SceneReference
field.
But everything broke down when I went to make a build. I get four errors:
1:Internal build system error. Backend exited with code 139.
2:Error building Player because scripts had compiler errors
3:Build completed with a result of 'Failed' in 11 seconds (11360 ms) UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)
4:UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ce] in /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:193 at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:94 UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)
I have tried to manually locate assembly UnityEditor.CoreModule
and reference it in my utility assembly's assembly definition asset
but couldn't find it. It still works great in the editor but won't compile for a build. If anyone has a solution or at least knows why this isn't working, I would be most appreciative.