Log in or register to post comments

Unexpected OnGUI behavior w/ Buttons

May 14, 2011 - 11:33am #1

The following script calls a camera control interface, though there is no reference to the camera, or any such control interface in the script. I've also tested this by changing the class and script names to determine whether there may be a naming collision at play, but that doesn't appear to be the case.


using UnityEngine;
using System.Collections;

public class GUIDefinition: MonoBehaviour {

	// Use this for initialization
	void Start () {
	// Update is called once per frame
	void Update () {
	void OnGUI(){
		if (GUI.Button (new Rect (10,10,150,100), "Button")) {
			print ("You clicked the button!");


presents this screen when the button is clicked - the button will toggle the control.

The interface that's presented is operational, it does control the camera.

Any ideas as to what's going on here? Has anyone else run into this? The behavior occurs w/ both debug and release builds. I'm working w/ the most current version of Unity on Win7, using the current QCAR extension. The project is structured similarly to ImageTargets and the script is attached to a 3D model that's the child of the trackable.

I realize that this probably isn't a QCAR issue, and that OnGUI isn't even the recommended approach for Android, but thought I'd share it anyway.

Re: Unexpected OnGUI behavior w/ Buttons

May 14, 2011 - 7:05pm #2

I'd misread the CameraDeviceMenu code - this behavior is actually what's defined in the script. Nevermind :rolleyes:

Log in or register to post comments