Fix VideoPanel reference, automatically find Canvas/VideoPanel and add components if missing

This commit is contained in:
yangbear
2026-07-10 04:41:26 +08:00
parent 745b11b7f0
commit 80cb7598e6
4 changed files with 57 additions and 1 deletions
+14 -1
View File
@@ -134,9 +134,22 @@ public class PingClickHandler : MonoBehaviour
// 隐藏视频面板
var videoController = FindObjectOfType<VideoController>(true);
if (videoController != null)
if (videoController == null)
{
var allT = Resources.FindObjectsOfTypeAll<Transform>();
foreach (var t in allT)
{
if (t.name == "VideoPanel" && t.parent != null && t.parent.name == "Canvas")
{
t.gameObject.SetActive(false);
break;
}
}
}
else
{
videoController.StopVideo();
videoController.gameObject.SetActive(false);
}
}
}