Fix VideoPanel reference, automatically find Canvas/VideoPanel and add components if missing
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user