EasyAR相机闪光灯

问题描述 投票:0回答:1

使用 EasyAR 和 unity 3d

我想启用相机闪光灯

我已经使用了这个代码,但它不起作用

它向我显示了这些行中的错误

cameraDevice.CameraParameters.FlashTorchMode

错误 CS1061“object”不包含“FlashTorchMode”的定义,并且找不到接受“object”类型的第一个参数的可访问扩展方法“FlashTorchMode”(是否缺少 using 指令或程序集引用?)

using UnityEngine;
using easyar;

public class FlashController : MonoBehaviour
{
    private CameraDeviceBehaviour cameraDevice;

    private void Start()
    {

        // Get the CameraDeviceBehaviour component
        cameraDevice = GetComponent<CameraDeviceBehaviour>();
    }

    public void EnableFlash()
    {
        // Enable the flash
        cameraDevice.CameraParameters.FlashTorchMode = true;
    }

    public void DisableFlash()
    {
        // Disable the flash
        cameraDevice.CameraParameters.FlashTorchMode = false;
    }
}
c# unity-game-engine augmented-reality easyar
1个回答
0
投票

API - 版本 4.6 中搜索(在这种情况下始终是您的第一个最好的朋友),我只能看到

CameraDevice.setFlashTorchMode
,这是一个 方法 而不是属性。

public void EnableFlash()
{
    // Enable the flash
    cameraDevice.setFlashTorchMode(true);
}

public void DisableFlash()
{
    // Disable the flash
    cameraDevice.setFlashTorchMode(false);
}

=> 也许您使用/找到的代码来自旧版本。

© www.soinside.com 2019 - 2024. All rights reserved.