internal static void DoAddLandmark(Transform root, Transform content, Action onLandmarkCreated = null)
        {
            var proxy = root.GetComponentInChildren <Proxy>();

            if (proxy == null)
            {
                Debug.LogError(k_LandmarkErrorMessage);
                return;
            }

            var landmarkCalculator = proxy.GetComponent <ICalculateLandmarks>()
                                     ?? proxy.gameObject.AddComponent <PlaneLandmarksAction>();

            LandmarkControllerEditor.ShowLandmarksMenu(landmarkCalculator, landmarkController =>
            {
                onLandmarkCreated?.Invoke();

                var existingLandmark = content.GetComponent <LandmarkController>();

                if (existingLandmark == null)
                {
                    content.parent = landmarkController.transform;
                }
                else
                {
                    foreach (Transform child in content)
                    {
                        child.parent = landmarkController.transform;
                    }

                    UnityObject.DestroyImmediate(existingLandmark.gameObject);
                }
            });
        }
        internal static string GetLandmarkName(Transform root)
        {
            var landmark = root.GetComponent <LandmarkController>();

            var type = LandmarkControllerEditor.TrimLandmarkOutputName(landmark.output.GetType().Name);

            var settingsDescription = string.Empty;

            if ((landmark.settings is ClosestLandmarkSettings settings) && (settings.target))
            {
                settingsDescription = $" to {settings.target.name}";
            }

            var landmarkDefinition = "Misconfigured landmark";

            if (landmark.landmarkDefinition != null)
            {
                landmarkDefinition = landmark.landmarkDefinition.name;
            }

            return($"{landmarkDefinition} {type}{settingsDescription}");
        }
 public override void OnInspectorGUI()
 {
     base.OnInspectorGUI();
     LandmarkControllerEditor.DrawAddLandmarkButton((ICalculateLandmarks)target);
 }