I created a panel for showing some text according to image recognized using vuforia in unity. So when detected image targets are changed, text should change according to that imagetarget. I need c# code for that. Please help!
0
votes
1 Answers
0
votes
if you want a set piece of text for each unique image target, you just need to make that text GameObject a child of the image target it relates to in the Unity scene view
Or if you want a button to change the text you can have something like this
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI; //This line is important
public class TextBehaviour : MonoBehaviour
{
//declare the text as a public variable
public Text myText;
//method for changing the text
public void changeText()
{
myText.text = "my text will change to this";
}
}
and then attach the script to a placeholder GameObject and apply the method to the button (sorry that's not the most helpful i know - there are loads of videos on youtube that help with this kind of thing though!)
It's hard to say anything more specific without more imformation about what it is you want to do Hope this helps!