c# - 即使未启用游戏对象也会自动启用
问题描述
我有两个面板 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);
}
解决方案
推荐阅读
- java - Spring集成DSL lastTime没有更新错误
- html - 如何在所有行中将列缩小到该列的最大宽度,例如表格中的 td 宽度?
- android - 解码 WAV 格式的文件
- c++ - 如果类模板将实例化,则变量模板为真?
- laravel - Laravel sanctum & nuxt/auth-next 请求自动获取用户不再发送
- media-queries - 媒体查询不适用于 CSS 模块
- python - Python Gstreamer:获取图像数组并放入 Gstreamer
- python - 如何在 Python 中计算百分比
- kubernetes - Kubernetes:为什么我的 pod 清单中忽略了 HostIP
- php - Phalcon:setStatusCode 返回空响应