We’re making an iPad app where we want to use Unity in some parts of the app, not running it in fullscreen as is the default.
I have managed to get Unity to start in a view instead and instanciated from a NIB file.
Now to my problem, I want to be able to release the Unity instance I have created and load a new instance for use with a different scene. This would be in a different part of the app, where the view could have different dimensions than the first view.
When I try to run the UnityInitApplication a second time it crashes with the following message:
Mono path[0] = '/var/mobile/Applications/C1566C8B-7CA4-463F-B84B-23D0787281BD/UnityTest.app/Data/Managed'
* Assertion: should not be reached at domain.c:1253
Any help would be much appreciated, is it possible at all?
i did something similar in Rolls Royce Ghost. But there i never shutdown Unity, i just paused it.
The user can navigate to non unitycontent, but that is put on top of the unityview. When the user goes back, unity is unpaused. This has the advantage of having no loadtime for unity from the 2nd start, but on the other hand it uses more memory.
You could try that and instead of just unpause load another scene.
How to shutdown completly and restart again i don´t know unfortunatly.
Yeah, that would be my fallback if it’s not possible to restart. Problem is, I would like the ability to change the aspect ratio and size of the view and that is only possible in the callback function as far as i know.
Also, Unity is quite memory intensive and being able to free up memory on demand is a nice feature to have.
Anyone else (perhaps some Unity folks) have any thoughts?
making unity appear in a smaller View should also be possible. While i was trying to figure out how to achieve Iphone4 HD Retina output, i sometimes resulted in having hd, but only at one quarter of the screen.
Setting upt the eagl view is somewhere burried in appcontroller.mm. You need to search for window, eagl view and buffers. Only making the view smaller will probably result in garbage on the screen. The buffers need to be set accordingly.
Search the forum for something like “Cool got hires output to work on iphone4”. Thats one of my posts and i point to the codesnippets which need to be changed in a 1.7 project to change the view and buffersize.
In unity 3 this might be slightly different.
Depending on what you want to achieve it might be better to not use unity at all but do everything in OpenGL yourself. This way, you have precise control on everything and your appsize will go down drastically.
This might be desirable if you only want to show some 3d models, without using physics, sound, to much animation and so on.
I just worked on a project that shows a augmented reality racing car. The code to do that was not that much, and leaving AR aside would be like to classes.
Maybe you find a tutorial on that approach on google and can just go with that.