Windows10でビルドしようとしているのですが、error CS0103が出てビルドできずに困っています。
エラー内容は、
Assets\GoogleVR\Scripts\InstantPreview\InstantPreviewHelper.cs(49,16): error CS0103: The name 'InstantPreview' does not exist in the current context で、InstantPreviewHelper.csの中身は、以下です。
C#
1//----------------------------------------------------------------------- 2// <copyright file="InstantPreviewHelper.cs" company="Google Inc."> 3// Copyright 2017 Google Inc. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// 9// http://www.apache.org/licenses/LICENSE-2.0 10// 11// Unless required by applicable law or agreed to in writing, software 12// distributed under the License is distributed on an "AS IS" BASIS, 13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// </copyright> 17//----------------------------------------------------------------------- 18 19using System.IO; 20using System.Runtime.InteropServices; 21using Gvr.Internal; 22#if UNITY_EDITOR 23using UnityEditor; 24#endif 25using UnityEngine; 26 27/// <summary>Helper methods for Instant preview.</summary> 28[ExecuteInEditMode] 29[HelpURL("https://developers.google.com/vr/unity/reference/class/InstantPreviewHelper")] 30public class InstantPreviewHelper : MonoBehaviour 31{ 32 /// <summary>Path to `adb` executable.</summary> 33 public static string adbPath; 34 35 /// <summary>Path to `aapt` executable.</summary> 36 public static string aaptPath; 37#if UNITY_ANDROID && UNITY_EDITOR 38 39#if UNITY_WINDOWS 40 private const string CHECK_ANDROID_SDK_PATH = 41 "Verify that your Android SDK path is configured correctly" + 42 " (Edit > Preferences > External Tools > Android SDK).\n" + 43 "See https://docs.unity3d.com/Manual/android-sdksetup.html for more information."; 44#else 45 private const string CHECK_ANDROID_SDK_PATH = 46 "Verify that your Android SDK path is configured correctly" + 47 " (Unity > Preferences > External Tools > Android SDK).\n" + 48 "See https://docs.unity3d.com/Manual/android-sdksetup.html for more information."; 49#endif // UNITY_WINDOWS 50 51#if !OVRPLUGIN_UNSUPPORTED_PLATFORM 52 [DllImport(InstantPreview.dllName)] 53#endif 54 private static extern bool SetAdbPathAndStart(string adbPath); 55 56 private void Awake() 57 { 58 // Gets android SDK root from preferences. 59 var sdkRoot = EditorPrefs.GetString("AndroidSdkRoot"); 60 if (string.IsNullOrEmpty(sdkRoot)) 61 { 62 Debug.LogError(CHECK_ANDROID_SDK_PATH); 63 return; 64 } 65 66 // Gets adb path from known directory. 67 adbPath = Path.Combine(Path.GetFullPath(sdkRoot), 68 "platform-tools" + Path.DirectorySeparatorChar + "adb"); 69 70 // Gets latest build-tools subdirectory. 71 string LatestBuildToolsDir = GetLatestBuildToolsDir(sdkRoot); 72 if (LatestBuildToolsDir != null) 73 { 74 // Gets aapt path from known directory. 75 aaptPath = Path.Combine(Path.GetFullPath(LatestBuildToolsDir), "aapt"); 76 } 77 else 78 { 79 Debug.LogError(string.Format("build-tools not found in \"{0}\". Please add " + 80 "build-tools to your SDK path and restart the Unity " + 81 "editor.", Path.GetFullPath(sdkRoot))); 82 return; 83 } 84#if UNITY_EDITOR_WIN 85 adbPath = Path.ChangeExtension(adbPath, "exe"); 86 aaptPath = Path.ChangeExtension(aaptPath, "exe"); 87#endif // UNITY_EDITOR_WIN 88 89 if (!File.Exists(adbPath)) 90 { 91 Debug.LogErrorFormat("\"{0}\" not found. {1}", adbPath, CHECK_ANDROID_SDK_PATH); 92 return; 93 } 94 95 if (!File.Exists(aaptPath)) 96 { 97 Debug.LogError(string.Format("aapt not found at \"{0}\". Please add aapt to your SDK " + 98 "path and restart the Unity editor.", aaptPath)); 99 return; 100 } 101 102 // Try to start server. 103 var started = SetAdbPathAndStart(adbPath); 104 if (!started) 105 { 106 Debug.LogErrorFormat("Couldn't start Instant Preview server using \"{0}\".", adbPath); 107 } 108 } 109 110#elif UNITY_EDITOR 111 void Awake() 112 { 113 Debug.LogWarning("Instant Preview is disabled; set target platform to Android to use it."); 114 } 115 116#endif 117 118 // Split vesion directory paths (eg "Path/To/Build-Tools/23.0.2") into an array of ints 119 // (eg [23, 0, 2]). 120 private int[] GetIntValuesFromString(string DirPath) 121 { 122 string DirName = Path.GetFileName(DirPath); 123 string[] VersionValues = DirName.Split('.'); 124 int[] VersionInts = new int[VersionValues.Length]; 125 for (int j = 0; j < VersionValues.Length; ++j) 126 { 127 if (!int.TryParse(VersionValues[j], out VersionInts[j])) 128 { 129 VersionInts[j] = 0; 130 } 131 } 132 133 return VersionInts; 134 } 135 136 // Get the numerically latest subdirectory within build-tools subdirectories, (eg select 101.0.1 137 // rather than 99.5.3). 138 // Returns the full path (eg /path/to/build-tools/101.0.1). 139 private string GetLatestBuildToolsDir(string sdkRoot) 140 { 141 string[] BuildToolsDirs = Directory.GetDirectories(Path.Combine( 142 Path.GetFullPath(sdkRoot), string.Format("build-tools"))); 143 if (BuildToolsDirs.Length == 0) 144 { 145 return null; 146 } 147 148 string LatestBuildToolsDir = BuildToolsDirs[0]; 149 int[] LatestVersionInts = GetIntValuesFromString(LatestBuildToolsDir); 150 for (int i = 1; i < BuildToolsDirs.Length; ++i) 151 { 152 int[] CurrentVersionInts = GetIntValuesFromString(BuildToolsDirs[i]); 153 154 // Compare ints sequentially. 155 for (int j = 0; j < Mathf.Min(LatestVersionInts.Length, CurrentVersionInts.Length); ++j) 156 { 157 if (LatestVersionInts[j] > CurrentVersionInts[j]) 158 { 159 break; 160 } 161 else if (CurrentVersionInts[j] > LatestVersionInts[j] || 162 j == LatestVersionInts.Length - 1) 163 { 164 // If one string version string has more elements than the other and leading 165 // digits are the same, it's probably newer. 166 LatestVersionInts = CurrentVersionInts; 167 LatestBuildToolsDir = BuildToolsDirs[i]; 168 } 169 } 170 } 171 172 return LatestBuildToolsDir; 173 } 174} 175 176#if !UNITY_ANDROID && UNITY_EDITOR 177[CustomEditor(typeof(InstantPreviewHelper))] 178public class InstantPreviewHelperEditor : Editor 179{ 180 public override void OnInspectorGUI() 181 { 182 EditorGUILayout.LabelField( 183 "Instant Preview is disabled; set target platform to Android to use it."); 184 } 185} 186#endif 187
タイプミスをしている箇所も見つからず、原因が分からず作業が停滞しております。何かお気づきの方がいましたら、ご教授願います。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。