Hi,
Could you please provide the follwing details:
Thx and greetings
Nicola
Using Unity 2019.3.0a011
Wikitude Sample Project 8.6
Xcode 10.1
I don't have an issue yet- I'm asking how do I change a scene when my image is recognized and not the standard use of placing a 3d model on it.
Thanks!
Hi,
This can only be done through scripting. The On Image Recognized event can only accept GameObjects with a script on them. In your script you can implement a simple method that changes the scene:
public void OnImageRecognized(ImageTarget recognizedTarget) { SceneManager.LoadScene("Name Of Scene"); }
You can then select this method in the On Image Recognized event.
Please also note that we don't test with alpha versions of Unity, so things might not work as expected. We recommend using only final versions of Unity.
Best regards,
Alexandru
Hi and thank you!
I am getting this error:
Assets/OnImageRecognition.cs(10,31): error CS0246: The type or namespace name 'ImageTarget' could not be found (are you missing a using directive or an assembly reference?)
this is the code I wrote;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class OnImageRecognition : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
void OnImageRecognized(ImageTarget recognizedTarget) {
Application.LoadLevel("Instant Tracking");
}
}
}
any ideas?
Thank you!!
Hi,
You're missing using statement at the top of your script. Also, the OnImageRecognized method should not be part of the Start method, but outside of it. Finally, the Application.LoadLevel API is deprecated, which is why I suggested using the SceneManager.LoadScene method.
using UnityEngine; using UnityEngine.SceneManagement; using Wikitude; public class OnImageRecognition : MonoBehaviour { public void OnImageRecognized(ImageTarget recognizedTarget) { SceneManager.LoadScene("Instant Tracking"); } }
Best regards,
Alexandru
Thank you that works great!
Maya Shekel
Hi,
I'm interested in changing a scene on image recognition to my instant tracking scene, I would like to know how I could apply this? Is it only through using code or can I just drag my scene to "On Image Recognized" if so, are there any other stages I need to apply?
Thank you!