DependencyWarning3DGameKit.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Animancer // https://kybernetik.com.au/animancer // Copyright 2018-2024 Kybernetik //
  2. #if UNITY_EDITOR
  3. using UnityEditor;
  4. using UnityEngine;
  5. namespace Animancer.Samples.AnimatorControllers.GameKit
  6. {
  7. /// <summary>Warns the user if the 3D Game Kit is missing.</summary>
  8. ///
  9. /// <remarks>
  10. /// <strong>Sample:</strong>
  11. /// <see href="https://kybernetik.com.au/animancer/docs/samples/animator-controllers/3d-game-kit">
  12. /// 3D Game Kit</see>
  13. /// </remarks>
  14. ///
  15. /// https://kybernetik.com.au/animancer/api/Animancer.Samples.AnimatorControllers.GameKit/DependencyWarning3DGameKit
  16. ///
  17. [AddComponentMenu(Strings.SamplesMenuPrefix + "Game Kit - Dependency Warning")]
  18. [AnimancerHelpUrl(typeof(DependencyWarning3DGameKit))]
  19. public class DependencyWarning3DGameKit : MonoBehaviour
  20. {
  21. /************************************************************************************************************************/
  22. [SerializeField]
  23. private GameObject _Reference;
  24. /************************************************************************************************************************/
  25. protected virtual void OnValidate()
  26. {
  27. if (_Reference == null)
  28. return;
  29. if (PrefabUtility.GetPrefabInstanceStatus(_Reference) != PrefabInstanceStatus.MissingAsset)
  30. return;
  31. if (EditorUtility.DisplayDialog(
  32. "3D Game Kit Lite Required",
  33. "The 3D Game Kit Lite is required for this sample",
  34. "Open Asset Store",
  35. "OK"))
  36. Application.OpenURL("https://assetstore.unity.com/packages/templates/tutorials/3d-game-kit-lite-135162");
  37. }
  38. /************************************************************************************************************************/
  39. }
  40. }
  41. #endif