I read several answers on the Unity forum, including here and only show how to create a subclass and present my first UIViewController.
- (void)createViewHierarchyImpl
{
homeViewController = [[HomeViewController alloc] initWithNibName:@"HomeViewController" bundle:nil];
//_rootView = _unityView;
_rootView = homeViewController.view;
//_rootController = [[UnityDefaultViewController alloc] init];
_rootController = homeViewController;
}
So far, so good.
The problem is that there are no examples for the new version of the Unity plugin that generates XCode, to show a UIViewController with Unity.
-(void)goToUnity:(id)sender
{
NSLog(@"touch the button is OK");
UIViewController *app = [[UIViewController alloc] initWithNibName:@"UnityView" bundle:nil];
[self.navigationController pushViewController:app animated:YES];
}
Thus, nothing happens. Is there any way to call the Unity in "default" mode Xcode?
Thank you.
Read an read and read many times, test and erros many times, i finally do! Touch a UIButton and open or do whatever you imagine with it.
I will share here for those who need a more complete code.
Getting Started:
You need to create your own main file .h and .m to be "overruled" the Unity automatically:
mainAppController.h
You have to import this H headers to controll Unity stuffs.
mainAppController.m
This last line is the Unity which will "read" and use.
So, see, I used the storyboard, so I have more control over the navigation visually. But you can use whatever you want.
In another any UIViewController, I'll call the Unity, as follows:
ShowARViewController.h
ShowARViewController.m
See, so I can have more control of Unity that I added in UIView and I can do what I want, for example, add a button above this view.
I hope I have helped really. If you have any questions or suggestions to make this code better, feel free to write me.
Regards
Try getting the controller like this: