Log in or register to post comments

Error CS0103: The name `CameraDevice' does not exist in the curr

April 27, 2016 - 10:50am #1

Sorry for this question.. I know nothing about coding..

I tried to make the flash on the camera to on and off when a button is push. I get that error CS0103.. How to fix that and if you can please provide the correct coding (fix my coding) directly.. Thanks..

using UnityEngine;
using System.Collections;

public class Flashlight : MonoBehaviour 
{
			public GUIStyle buttonGroupStyle;
			public bool mFlashEnabled = false;

			// Use this for initialization
			void OnGUI()
			{
				// Setup style for buttons.



				GUIStyle buttonGroupStyle = new GUIStyle(GUI.skin.button);

				buttonGroupStyle.stretchWidth = true;
				buttonGroupStyle.stretchHeight = true;



				// Turn flash on or off.
				if (GUI.Button(new Rect (45,20,150,50),"Flashlight", buttonGroupStyle))


				{
			     CameraDevice.Instance.SetFlashTorchMode( true );  // or false
				}
			}
}

 

Error CS0103: The name `CameraDevice' does not exist in the curr

April 28, 2016 - 1:04pm #5

You can turn the flash torch with:

CameraDevice.Instance.SetFlashTorchMode( false ); 

 

Error CS0103: The name `CameraDevice' does not exist in the curr

April 28, 2016 - 7:08am #4

Opss.. there another problem... The script works, but i can't turn off the flashlight by pressing the button.. The turn on works just fine, but not when turn off..

Error CS0103: The name `CameraDevice' does not exist in the curr

April 28, 2016 - 6:53am #3

Oh my... Thank you very much..I had try to google the solution before, but came out with nothing.. Don't know the solution would be this simple.. I feel so stupid right now... :)

Error CS0103: The name `CameraDevice' does not exist in the curr

April 28, 2016 - 12:58am #2

add this line at the top of your script:

using Vuforia;

 

Log in or register to post comments