Home>
I want to build Oculus go in Unity but I get a compile error

I'm making an oculus go, quest app with unity, but I get a compal error. (Currently, I am practicing only with go.)

Assets/Plugins/RenderHeads/HierarchyRestore/Scripts/HierarchyNode.cs (53,8): error CS0103: The name'HierarchyUtils' does not exist in the current context

Build completed with a result of'Failed' in 4 seconds (3990 ms)
UnityEditor.BuildPlayerWindow: BuildPlayerAndRun () (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindow.cs:136)

UnityEditor.BuildPlayerWindow + BuildMethodException: Error building Player because scripts have compile errors in the editor
at UnityEditor.BuildPlayerWindow + DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002af] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:194
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:95
UnityEditor.BuildPlayerWindow: BuildPlayerAndRun () (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindow.cs:136)

Error message
Corresponding source code

c #
`` Enter the language name here Source code #if UNITY_5_3 || UNITY_5_4_OR_NEWER

define RH_UNITY_FEATURE_SCENEMANAGMENT endif if UNITY_5_4_OR_NEWER || (UNITY_5&&! UNITY_5_0) define RH_UNITY_FEATURE_DEBUG_ASSERT endif

using UnityEngine;
// Note: This script is only for the editor, but we don't put it into an Editor folder because it needs to be attached to a Monobehaviour

if UNITY_EDITOR

using UnityEditor;

if RH_UNITY_FEATURE_SCENEMANAGMENT

using UnityEditor.SceneManagement;

endif

// ------------------------------------------------ -----------------------------
// Copyright 2017-2019 RenderHeads Ltd. All rights reserverd.
// ------------------------------------------------ -----------------------------

namespace RenderHeads.Framework.Editor
{
///


/// This component is mainly used to detect when a scene is unloaded as it uses the OnDestroy () hook to save the current hierarchy state
///

[ExecuteInEditMode]
public class HierarchyNode: MonoBehaviour
{
private string _sceneGUID;
private string _selectionPathList;
private string _hierarchyPathList;
private int editorUpdateCount;
private bool _isHierarchyDirty;
private static Transform [] _lastSelection;

private void Start ()
{
RestoreSelection ();
}

private void OnEnable ()
{
EditorApplication.update + = OnEditorUpdate;
}

private void OnDisable ()
{
EditorApplication.update-= OnEditorUpdate;
}

// When the scene closes, this node will get destroyed, at which point we save the scene state information
private void OnDestroy ()
{
if (HierarchyUtils.IsHierarchyWindowInPrefabMode ())
{
return;
}

SaveHierarchyState (_hierarchyPathList, _sceneGUID);
SaveSelectionState (_selectionPathList, _sceneGUID);
}

private void RestoreSelection ()
{
if (HierarchyUtils.IsHierarchyWindowInPrefabMode ())
{
return;
}

UpdateSceneGUID ();
if (! string.IsNullOrEmpty (_sceneGUID))
{
_hierarchyPathList = RestoreHierarchyState (_sceneGUID, true);
_selectionPathList = RestoreSelectionState (_sceneGUID, true);
//Debug.Log ("hierarchy" + _hierarchyPathList);
//Debug.Log ("selection" + _selectionPathList);
if (string.IsNullOrEmpty (_selectionPathList))
{
// No selection was restored, so we need to select at least one node so that the hierarchy expansion happens.
// So just select one of the items in the hierarchyList
string [] paths = null;
{
// Convert the string list to an array
if (! string.IsNullOrEmpty (_hierarchyPathList))
{
paths = _hierarchyPathList.Split (new char [] {'*'}, System.StringSplitOptions.RemoveEmptyEntries);
}

// Select the first found expanded object
if (paths! = null&&paths.Length>0)
{
foreach (string path in paths)
{
GameObject go = GameObject.Find (path);
if (go! = null)
{
Selection.activeGameObject = go;
break;
}
}
}
}
}

// Only force the hierarchy window to update if something has changed
if (Selection.activeGameObject! = Null ||! String.IsNullOrEmpty (_hierarchyPathList))
{
// Force the hierarchy window to update to the current selection
EditorApplication.DirtyHierarchyWindowSorting ();

// NOTE: We need to use the delayCall because sometimes DirtyHierarchyWindowSorting () doesn't work the first time
EditorApplication.delayCall + = () =>
{
// Force the hierarchy window to update to the current selection
EditorApplication.DirtyHierarchyWindowSorting ();
};
}
}
}

private void OnEditorUpdate ()
{
// Editor updates are expensive, so don't do them too often as it can slow down the UI
if (editorUpdateCount>50&&
// We don't want to save hierarchy/selection when the app is playing
! EditorApplication.isPlaying&&
! EditorApplication.isPlayingOrWillChangePlaymode&&
! EditorApplication.isCompiling&&
! EditorApplication.isUpdating&&
! HierarchyUtils.IsHierarchyWindowInPrefabMode ())
{
editorUpdateCount = 0;
if (HasSelectionChanged () || HasHierarchyChanged ())
{
CacheHierarchy ();
}
}
editorUpdateCount ++;
}

public void SetHierarchyDirty ()
{
_isHierarchyDirty = true;
}

private bool HasHierarchyChanged ()
{
return _isHierarchyDirty;
}

private static bool HasSelectionChanged ()
{
bool result = false;
// Ignore null selections
if (Selection.activeGameObject! = Null)
{
if (_lastSelection == null)
{
result = true;
}
else else
{
if (Selection.transforms.Length! = _LastSelection.Length)
{
result = true;
}
else else
{

if RH_UNITY_FEATURE_DEBUG_ASSERT

Debug.Assert (Selection.transforms.Length == _lastSelection.Length);

endif

for (int i = 0;i<_lastSelection.Length;i ++)
{
if (_lastSelection [i]! = Selection.transforms [i])
{
result = true;
break;
}
}
}
}

if (result)
{
_lastSelection = Selection.transforms;
}
}
return result;
}

private void CacheHierarchy ()
{
UpdateSceneGUID ();

if (Selection.activeGameObject! = Null)
{
_selectionPathList = HierarchyUtils.GetSelectionAsString ();
}

_hierarchyPathList = HierarchyUtils.GetHierarchyAsString ();
_isHierarchyDirty = false;
}

private void UpdateSceneGUID ()
{

if RH_UNITY_FEATURE_SCENEMANAGMENT

_sceneGUID = GetSceneGUID (EditorSceneManager.GetActiveScene (). Path);

else else

_sceneGUID = GetSceneGUID (EditorApplication.currentScene);

endif

}

public static string GetSceneGUID (string path)
{
return GetFullPath (path);
}

private static string GetFullPath (string relativePath)
{
string result = relativePath;
if (! string.IsNullOrEmpty (result))
{
result = System.IO.Path.GetFullPath (result);
result = result.Replace ('\\','/');
}
return result;
}

public static string RestoreSelectionState (string sceneId, bool logMissingNodes)
{
string result = EditorPrefs.GetString (GetEditorPref ("Selection", sceneId), string.Empty);
if (! HierarchyUtils.SetSelectionFromString (result, logMissingNodes))
{
result = string.Empty;
}
return result;
}

public static string RestoreHierarchyState (string sceneId, bool logMissingNodes)
{
// If it returns notset then this scene hasn't had any hierarchy state saved before
// If it returns null/empty, then all hierarchy is collapsed
string notset = "notset";
string result = EditorPrefs.GetString (GetEditorPref ("Hierarchy", sceneId), notset);
if (result! = notset)
{
HierarchyUtils.SetHierarchyFromString (result, logMissingNodes);
}
else else
{
result = string.Empty;
}
return result;
}

public static void SaveSelectionState (string state, string sceneId)
{
// No point in saving empty selection
if (! string.IsNullOrEmpty (state))
{
SaveState ("Selection", state, sceneId);
}
}

public static void SaveHierarchyState (string state, string sceneId)
{
SaveState ("Hierarchy", state, sceneId);
}

private static void SaveState (string stateName, string state, string sceneId)
{
//Debug.Log ("SAVING:" + state + "" + GetEditorPref (stateName, sceneId));
EditorPrefs.SetString (GetEditorPref (stateName, sceneId), state);
}

private static string GetEditorPref (string name, string sceneId)
{
return string.Format ("RenderHeads-HierarchyRestore-{0}-{1}", name, sceneId);
}
}
}

endif What I tried

I searched for articles about errors and compilation errors, but I don't know how to fix the hierarchy. Thank you.

Please describe here what you have tried for the problem.

Supplementary information (FW/tool version, etc.)

Please provide more detailed information here.

unity 2019
oculus go

  • Answer # 1

    I couldn't find a way to fix the error, so I tried to recreate the unity project again. I get an error depending on the asset to be imported, but I was able to solve each error for the time being, so I will start over from the beginning and start over. Thank you very much.