I am using unity and vuforia for Android to create an AR app (project). I have a 3d text and i want to change it’s position corresponding to user’s location.
Right now, i can get his location and updates and i can show it on a Gui label using OnGUI function.
The 3d Text is a prefab so do i have to instantiate it everytime the user gets to a new location?
The 3d Text should appear only once (depending his current location). That means, i have to destroy first, previous instantiated texts or will it be overriden?
Finally, where should i write the instantiation code? I mean, on the Update() function? Start()? so to be run only when location changes and not all the time.
I am currently getting familiar with Unity and i am trying to figure out how it works.
Ask me if you would like more information.
Thank you in advance for your time and answers!
Depends on your project setup and there are probably other ways to do this but I would suggest hiding the 3D Text via the mesh renderer. In your code you want to check in the update function if there`s been a change in the location since the last update. How you go about this is by creating two variables: one for the users current position and one for the position at the previous update call. So the secret here is two functions: Update and LateUpdate.
Here`s an example
Doing things this way you don’t have to face the headache of cleaning up your scene as you only have once instance of the 3DText to deal with. I hope this helps… it might need a lil bit of work but i gotta run now. Lemme know if you need me to explain a lil more.