|
Hello, Is is possible for my script to be notified at the moment the device changes orientation? I'd rather not keep testing for device orientation on each frame... Maybe there's something like the delegate protocols in Obj-C, but no amount of searching or looking through the docs has helped. Any help much appreciated!
(comments are locked)
|
|
I figured it out using UnitySendMessage - in Xcode, in "AppController.mm", in -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation I added: and in Unity, in the script on my Game Manager gameObject I added - Being new to Unity I hadn't realised there could be 2-way communication between Unity & the Obj-c stuff. Probably elementary to most people here, but I thought I'd post it in case it helps someone avoid the troubles I had. I guess I'm newer to Unity, because I don't understand that. You wrote "in Xcode...", but I thought you could only code in C# or unityscript. Where does that code go?
Oct 30 '12 at 01:44 AM
B-rad
It goes into your XCode project when you build for iOS.
Oct 30 '12 at 08:53 PM
bzgeb
ah, okay. Thanks.
Oct 30 '12 at 08:58 PM
B-rad
Not the best solution, if you can avoid editing your xCode project you should, Because a new build won't have this included.
Dec 20 '12 at 06:21 PM
J3 Gaming
(comments are locked)
|
