Module_SkyBox.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using SC.XR.Unity;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. namespace SC.XR.Unity.Module_SkyBox {
  6. public class Module_SkyBox : MonoBehaviour {
  7. private static Module_SkyBox mInstance;
  8. public static Module_SkyBox getInstance {
  9. get {
  10. if (mInstance == null) {
  11. mInstance = new GameObject("SDKVersion").AddComponent<Module_SkyBox>();
  12. }
  13. return mInstance;
  14. }
  15. }
  16. SDKSkyBox SDKSkyBox;
  17. void Awake() {
  18. SDKSkyBox = Resources.Load<SDKSkyBox>("SDKSkyBox");
  19. if (SDKSkyBox == null) {
  20. DebugMy.Log("SDKSkyBox Not Exist !", this, true);
  21. }
  22. }
  23. public Material GetSkyBox(SkyBoxType type) {
  24. if (getInstance.SDKSkyBox != null) {
  25. foreach (var skybox in getInstance.SDKSkyBox.SkyBoxList)
  26. if (skybox.type == type) {
  27. return skybox.Material;
  28. }
  29. }
  30. return null;
  31. }
  32. }
  33. }