1
0

More than 1 year has passed since last update.

MRTK AppBarのRemoveボタンについて

Last updated at Posted at 2022-12-11

はじめに

MRTK AppBarのRemoveボタンについて、よく見てみると。。

導入

AppBar.csを開きます

AppBar.cs
        public void OnButtonPressed(AppBarButton button)
        {
            if (Time.time < lastTimeTapped + coolDownTime)
                return;

            lastTimeTapped = Time.time;

            switch (button.ButtonType)
            {
                case ButtonTypeEnum.Remove:
                    OnClickRemove();
                    break;

                case ButtonTypeEnum.Adjust:
                    State = AppBarStateEnum.Manipulation;
                    break;

                case ButtonTypeEnum.Hide:
                    State = AppBarStateEnum.Hidden;
                    break;

                case ButtonTypeEnum.Show:
                    State = AppBarStateEnum.Default;
                    break;

                case ButtonTypeEnum.Done:
                    State = AppBarStateEnum.Default;
                    break;

                default:
                    break;
            }
        }

OnClickRemove()関数では、SetActive(false);するだけで削除されていません。

AppBar.cs
        protected virtual void OnClickRemove()
        {
            // Set the app bar and bounding box to inactive
            if (Target is IBoundsTargetProvider boundsProvider && !boundsProvider.IsNull())
            {
                boundsProvider.Target.SetActive(false);
            }
            Target.gameObject.SetActive(false);
            gameObject.SetActive(false);
        }

Destroyで完全に消すといいです。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0