2

I'm developing an AR app that's going to contain an activity with a Unity3d model. Creating such an activity is something I can do now but I've come across another problem.

To show a unity model in an activity, the latter has to extend the UnityPlayerActivity class. What if I want to load the 3D model as soon as my launch activity starts but show it in one of the following ones? My goal would be to have the user wait for the model to be loaded as the app starts (e.g. when I show them a splash screen) so that when they change activity to the one that contains the AR view the waiting time is minimal.

I know this is possible in iOS and would like to replicate that behaviour in android as well. Any ideas?

1
  • I doubt it would be easy to get Unity to start loading a model without any UnityPlayerActivity instantiated. Maybe you can subclass it and have it immediately start another Activity at the end of its onResume() method so it will be hidden. But I'm not sure if UPA would continue loading in the background if another Activity is in front of it. Commented Jan 31, 2014 at 13:40

1 Answer 1

1

As I suspected - there aren't any answers to my question.

I'll answer my question myself with a workaround, then, and wait for someone else to come up or for the creators of Unity to provide us with the same functionality under Android as under iOS.

To achieve the desired effect, I decided to only have 1 activity and multiple fragments. The activity extends UnityPlayerActivity meaning that when it loads, that takes the time Unity needs to load. Then, when navigating throughout the app, I only swap fragments containing entire screens and make use of the UnityPlayer.pause() and UnityPlayer.resume() methods, as well as the setVisibility method to make it go away.

Hope that helps if anyone has any similar issues.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.