C# 更改场景时WebCamTexture崩溃

C# 更改场景时WebCamTexture崩溃,c#,android,unity3d,unityscript,unity5,C#,Android,Unity3d,Unityscript,Unity5,我试图使用WebCamTexture在两个场景中显示电话摄像机,但当我在android设备中加载第二个场景时,游戏崩溃了。我在相机前面创建了一个平面(作为电影屏幕),并附上了以下脚本: using UnityEngine; using System.Collections; public class CameraController : MonoBehaviour { public WebCamTexture mCamera; public GameObject plane;

我试图使用WebCamTexture在两个场景中显示电话摄像机,但当我在android设备中加载第二个场景时,游戏崩溃了。我在相机前面创建了一个平面(作为电影屏幕),并附上了以下脚本:

using UnityEngine;
using System.Collections;

public class CameraController : MonoBehaviour
{
    public WebCamTexture mCamera;
    public GameObject plane;

    void Start ()
    {
        plane = GameObject.FindWithTag ("PlayerCam");

        mCamera = new WebCamTexture ();
        plane.GetComponent<Renderer>().material.mainTexture = mCamera;
        mCamera.Play ();

    }

}
使用UnityEngine;
使用系统集合;
公共类CameraController:MonoBehavior
{
公共网络摄像机;
公共游戏对象平面;
无效开始()
{
平面=GameObject.FindWithTag(“PlayerCam”);
mCamera=新的WebCamTexture();
plane.GetComponent().material.mainTexture=mCamera;
Play();
}
}

在unity编辑器中一切正常,但当我加载第二个场景时,我的android设备崩溃。有人能帮我吗?

在加载另一个场景之前,您需要销毁WebCamTexture