Hi, I have a private readonly class field of a ScriptableObject, named IntPlayerPref, which inherits from PlayerPref (abstract class), it works in Editor but in Mono build the ServerEnvironment getter down below throws a NullReferenceException.
Is this a known issue?
private readonly IntPlayerPref ServerEnvironmentPref = new IntPlayerPref(nameof(ServerEnvironment), PathHashPostfix.OnlyInEditor, (int)GameApplicationBuildArgs.GetDefaultServerEnvironment());
[ShowInInspector, Title("Server Environment"), PropertyOrder(100)]
public ServerEnvironment ServerEnvironment
{
get
{
// This throws NullReferenceException on build, ServerEnvironmentPref is null
return (ServerEnvironment)ServerEnvironmentPref.Value;
}
set => ServerEnvironmentPref.Value = (int)value;
}
Edit: This is solved. It’s not a Unity bug, the Constructor was throwing an exception on build