Reputation: 41
I am developing a augmented reality application that download asset bundle from the web and instantiate different object depending on the image target. What I am trying to do is to not automatically spawn the object but rather "pause" the script and wait for a button to be clicked by the user in order to spawn the object.
Upvotes: 0
Views: 356
Reputation: 41
Sorry about the previous answer. Here is a snippet of the code.
When the user scans a particular target, the app has to display (spawn) an object onto it. Currently the app does this automatically without any user interaction. What I am looking for is to interupt the spawning process after the bundle is downloaded.
public void OnFound() {
Debug.Log("[EasyAR] OnFound targtet name: " + target.name());
StartCoroutine(WaitForReq());
}
IEnumerator WaitForReq() {
while (!Caching.ready)
yield return null;
WWW www = WWW.LoadFromCacheOrDownload(url, version);
yield return www;
bundle = www.assetBundle;
clone = Instantiate(bundle.LoadAsset(model)) as GameObject;
}
What I was thinking of is to have an if statement before the models is instantiated in order to interrupt the process, but i am not sure how to implement it.
Hope that clears things out.
Upvotes: 1