public static void AddBrowserEngine(BrowserEngine engine) { if (!CheckIfAppExists(engine)) { Debug.LogError($"{engine.EngineName} is setup incorrectly!"); return; } BrowserEngines.Add(engine); }
/// <summary> /// Gets the folder that the cef process application lives in /// </summary> /// <returns></returns> public static string GetBrowserEnginePath(string engine) { //Editor #if UNITY_EDITOR Editor.BrowserEngine browserEngine = Editor.BrowserEngineManager.GetBrowser(engine); #if UNITY_EDITOR_WIN return(Path.GetFullPath(browserEngine.BuildFiles.FirstOrDefault(x => x.Key == UnityEditor.BuildTarget.StandaloneWindows || x.Key == UnityEditor.BuildTarget.StandaloneWindows64).Value)); #elif UNITY_EDITOR_LINUX return(Path.GetFullPath(browserEngine.BuildFiles.FirstOrDefault(x => x.Key == UnityEditor.BuildTarget.StandaloneLinux64).Value)); #endif //Player builds (Standalone) #elif UNITY_STANDALONE_WIN return(Path.GetFullPath($"{Application.dataPath}/Plugins/x86_64/")); #else return(Path.GetFullPath($"{Application.dataPath}/Plugins/")); #endif }
private static bool CheckIfAppExists(BrowserEngine engine) { foreach (KeyValuePair <BuildTarget, string> files in engine.BuildFiles) { string path = Path.GetFullPath(files.Value); string engineFile; if (files.Key == BuildTarget.StandaloneWindows || files.Key == BuildTarget.StandaloneWindows64) { engineFile = $"{engine.EngineAppFile}.exe"; } else { engineFile = engine.EngineAppFile; } if (!File.Exists($"{path}{engineFile}")) { Debug.LogError($"{files.Key} target is missing {engine.EngineAppFile}!"); return(false); } } return(true); }