Summary
VRCSDK 3.8.1-beta.1 has breaking changes for
IVRCSdkAvatarBuilderApi.BuildAndUpload
that requiring referencing more assemblies than before to access the method.
VRCSDK 3.8.1-beta.1 requires
VRC.SDK3A
assembly to be referenced in addition to
VRC.SDK3A.Editor
and
VRC.SDKBase.Editor
.
Description
VRCSDK 3.8.1-beta.1 added overload for
IVRCSdkAvatarBuilderApi.BuildAndUpload
that has
List<VRCPerPlatformOverride.PlatformOverrideOption>
as a parameter.
The
VRCPerPlatformOverride.PlatformOverrideOption
is defined in
VRC.SDK3A
assembly so the C# compiler requires
VRC.SDK3A
assembly to be referenced to access the
BuildAndUpload
method for overload resolution.
This is a breaking change because
VRC.SDK3A
assembly is not necessary to be referenced in the previous version of VRCSDK.
This Gist is the minimum reproducible code to reproduce the issue.
Download zip and extract to the
Assets
folder of Unity project with VRCSDK 3.8.1-beta.1 installed.
It will fails to compile with CS0012 error.
Possible Solutions
There is a solution to this problem without bumping the breaking version, and I hope this improves API design of VRCSDK.
That is to add struct similar to
PlatformOverrideOption
into
VRC.SDK3A.Editor
assembly, and copy the contents to
VRCPerPlatformOverride.PlatformOverrideOption
in the
Build
or
BuildAndUpload
.
This will resolve (revert) the breaking changes and will continue to work with existing code.
This shields the internal implementation of PlatformOverride by not exposing the
VRCPerPlatformOverride
component which is currently used for multi-platform build.
By exposing
VRCPerPlatformOverride.PlatformOverrideOption
onto the
[PublicAPI]
surface, it will (partially) expose the fact multi platform build is implemented with component, but it can be changed over the time so designing the API to be flexible is better.
In addition, Developers won't need to write long type name
VRCPerPlatformOverride.PlatformOverrideOption
in their code so this makes code easier to read.
Additional Notes
This is not a fatal but
IVRCSdkAvatarBuilderApi.BuildAndUpload
and their properties are not marked as
[PublicAPI]
that should be.