Log in or register to post comments

[HELP] Creating GUI Button and Animator Controller in User Defin

November 23, 2015 - 6:24pm #1

Hallo all, first of all I am sorry for my bad English.

I want to make an AR application using User Defined Target and I have some problems.

 

1. When I start the application, then I click the capture button and the object showed on the screen.

the object has animation using animator controller. When the object showed on the screen, the animation start automatically.

How if I want to make a GUI button for controlling the animation using C#? Where I must place the script (In the object or AR camera)?  

2. And I also want to make some buttons such as rotate button.

Any one can help me please..?

I am new player in Unity, I tried to make it since yesterday but i still can't.

 

I am expecting for your help. Thank you for any help.

 

--- This is the code in DefaultTrackableEventHandler.cs ---

public void OnTrackableStateChanged(
                                    TrackableBehaviour.Status previousStatus,
                                    TrackableBehaviour.Status newStatus)
    {
        if (newStatus == TrackableBehaviour.Status.DETECTED ||
            newStatus == TrackableBehaviour.Status.TRACKED ||
            newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED)
        {
            OnTrackingFound();
			sholat.GetComponent<Animator> ().enabled = true; 

			gameObject.gameObject.AddComponent("AudioListener");
			audio.Play();
        }
        else
        {
            OnTrackingLost();
			sholat.GetComponent<Animator> ().enabled = false; 
			Destroy(GetComponent("AudioListener"));
			audio.Pause();
        }
    }

 

Log in or register to post comments