【问题标题】:WebCamTexture crashes when I change the scene当我改变场景时,WebCamTexture 崩溃
【发布时间】:2016-09-28 16:12:47
【问题描述】:

我正在尝试使用 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 ();

    }

}

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

【问题讨论】:

    标签: c# android unity3d


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2019-05-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多