Basic Process

  1. Import the file SimpleJSON.cs to /Assets/PlugIns/SimpleJSON
  2. Create AC Camera and an ImageTarget in the scene.
  3. On the ImageTarget, click Add Component to add a new Script file named GET_Request.cs, which imports the JSON data file and adds object array to the ImageTarget.
  4. Create different Prefebs and just drag them from Assets to the ImageTarget’s Element array. The prefeb itself in the scene can be deleted.
  5. Based on what’s in the Element, and the JSON data (weatherType == “Clear”) , the scene shows different:

Further steps

My question: I created 3 ImageTargets, but their Elements’ Array always came out together. I can’t fix the problem…

So this video just showing the texts that getting from online JSON data.

 

Below are the problems I’ve encountered and my solutions:

1.Text UI Object:Font Size Cannot Go Over 28

Solution

2.Hide UI object when ImageTarget is not detected.

Key process:

1.Create C# file named:MyTrackableEventHandler

2.In the C# file: add  using Vuforia

3. In the C# file: add  public class MyTrackableEventHandler : MonoBehaviour,
ITrackableEventHandler

4. In the C# file: copy the code from  DefaultTrackableEventHandler.cs

5.In the C# file: add  public GameObject UI; UI.SetActive (true); UI.SetActive (false);

6.Drag the C# file to the ImageTarget.

 

Target Image