首页 > 解决方案 > 即使未启用游戏对象也会自动启用

问题描述

我有两个面板 P1 和 P2。P1 启用 GameObject M1 并在稍后检测到动作时禁用它。P1 被禁用后,P2 被启用。所以我的问题是当 P2 启用时,即使在 P2 面板中没有引用它(M1),也启用了 M1 游戏对象。

以下代码进入 P1 脚本。当 P2 启用 raiseRightHand gameObject 会自动启用,尽管 P2 面板中没有它 (M1) 的引用。

 private void OnDisable()
    {
        kinectWrapper.UnregisterForGesture(KinectGestures.Gestures.ThumbsUp, this);
        kinectWrapper.UnregisterKinectListener(this);
        raiseRightHand.SetActive(false);
        thumbsUp.SetActive(false);
        notificationPanel.SetActive(false);
        liveFeed.SetActive(false);
        liveFeed.GetComponent<GUITexture>().color = new Color(128f / 255, 128f / 255, 128f / 255, 128f / 255);
        //frontendController.SetUserFavColor(finalMaterial);
        rightHand.SetActive(false);
        canvasCursor.SetActive(false);
        bike.SetActive(false);
        for (int i = 0; i < particles.Count; i++)
        {
            gestureRecogniser.UnRegisterForGestureCallBack(i, this);
        }

        hoverToSelect.SetActive(false);

    }

标签: c#unity3d

解决方案


推荐阅读