Log in or register to post comments

Stop script on gameobject when tracking lost

May 13, 2014 - 3:20am #1

Hi all,

Im develpoing an AR app with a few game object attached to them. On one of the object that I have has a script that when it is tracked it triggers a GUI.Label that follows the object. But when the tracking is lost the script doesnt stop running the GUI label just stays in the last tracked position. My script is JS does any one know now I could monitor tracking state from JS?


Here is my code right now.


var screenPosition :  Vector3;
var bubble: Texture2D;

function Update (){

    screenPosition = Camera.main.WorldToScreenPoint(transform.position);

    screenPosition.y = Screen.height - screenPosition.y;


function OnGUI (){  

	if (screenPosition.x < 1250) {
	GUI.Label(Rect(screenPosition.x , screenPosition.y - 150, 500, 300), bubble);

	} else {
	Debug.Log("DONT GO SO FAR");




Log in or register to post comments