Skip to content
This repository was archived by the owner on Apr 27, 2024. It is now read-only.
This repository was archived by the owner on Apr 27, 2024. It is now read-only.

Errors in BuildCommands.cs with Unity 2018.1.0f2 on Open #51

@szelenka

Description

@szelenka

Cloning the HolographicAcademy-Holograms-220-SpatialSound branch and attempting to follow instructions on MR Spatial 220 will result in a number of errors:

Assertion failed: Removing Assets/HoloToolkit-SpatialSound-220/Input/Models/Cursor/cursor_hand_ready.fbm/templates because the asset does not exist
Assertion failed: Removing Assets/HoloToolkit-SpatialSound-220/Input/Models/Cursor/cursor_ready.fbm/templates because the asset does not exist
Shader error in 'HoloToolkit/StandardFast': invalid subscript 'uv2' at /Program Files/Unity/Editor/Data/CGIncludes/UnityStandardMeta.cginc(21) (on d3d11)

The main one which prevents a successful build is:

Assets/HoloToolkit-SpatialSound-220/Utilities/Editor/BuildCommands.cs(59,42): error CS0029: Cannot implicitly convert type UnityEditor.Build.Reporting.BuildReport' to string'

A workaround is to follow the guidelines on Unity's documentation for BuildPlayer:

        /// <summary>
        /// Do a build configured for the HoloLens, returns the error from BuildPipeline.BuildPlayer
        /// </summary>
        public static string BuildForHololens()
        {

            // Cache the current settings
            BuildSettings oldBuildSettings = BuildSettings.Current;

            // Define and apply the desired settings
            BuildSettings newBuildSettings = oldBuildSettings;
            newBuildSettings.BuildTarget = BuildTarget.WSAPlayer;
            newBuildSettings.WSASDK = WSASDK.UWP;
            newBuildSettings.WSAUWPBuildType = WSAUWPBuildType.D3D;
            newBuildSettings.Apply();

            // Capture the active scenes, and build
            var scenes = EditorBuildSettings.scenes.Where(s => s.enabled).Select(s => s.path);
            BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();
            buildPlayerOptions.scenes = scenes.ToArray();
            buildPlayerOptions.locationPathName = BuildLocation;
            buildPlayerOptions.target = newBuildSettings.BuildTarget;
            buildPlayerOptions.options = BuildOptions.None;
            UnityEditor.Build.Reporting.BuildReport error = BuildPipeline.BuildPlayer(buildPlayerOptions);

            // Restore old build settings
            oldBuildSettings.Apply();

            return error.ToString();
        }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions