MacWebPlugin.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /**
  2. * Copyright (c) 2021 Vuplex Inc. All rights reserved.
  3. *
  4. * Licensed under the Vuplex Commercial Software Library License, you may
  5. * not use this file except in compliance with the License. You may obtain
  6. * a copy of the License at
  7. *
  8. * https://vuplex.com/commercial-library-license
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #if (UNITY_STANDALONE_OSX && !UNITY_EDITOR) || UNITY_EDITOR_OSX
  17. using System;
  18. using UnityEngine;
  19. namespace Vuplex.WebView {
  20. /// <summary>
  21. /// The macOS `IWebPlugin` implementation.
  22. /// </summary>
  23. class MacWebPlugin : StandaloneWebPlugin, IWebPlugin {
  24. public static MacWebPlugin Instance {
  25. get {
  26. if (_instance == null) {
  27. _instance = (MacWebPlugin) new GameObject("MacWebPlugin").AddComponent<MacWebPlugin>();
  28. DontDestroyOnLoad(_instance.gameObject);
  29. }
  30. return _instance;
  31. }
  32. }
  33. public WebPluginType Type {
  34. get {
  35. return WebPluginType.Mac;
  36. }
  37. }
  38. public virtual IWebView CreateWebView() {
  39. return MacWebView.Instantiate();
  40. }
  41. static MacWebPlugin _instance;
  42. void OnValidate() {
  43. MacWebView.ValidateGraphicsApi();
  44. }
  45. }
  46. }
  47. #endif