iphone - Passing IOS native objects back to unity3d -


i implemented ios plugin couple of simple methods interract unity application native static library.

the problem, faced, passing native ui elements(objects) unity.

f.e native sdk has method creates badge (uiview), on other hand have button in unity (it gui element or 3d object, whatever)

i access method unity through plugin, smth like:

[dllimport("__internal")]     private static extern void xcodeplugin_getbadgeview();     

and following:

void xcodeplugin_getbadgeview() {     // generate native uiview      uiview *badge = [badge badge];      ???? return uiview badge instance unity (hm)?! } 

so need like:

[somevieworobject addsubview:badge]; 

but inside unity.

i know there ability send message unity:

unitysendmessage( "unitycsharpclassname" , "unitymethod", "whatevervaluetosendtounity"); 

but whatevervaluetosendtounity should utf8 string.

in conclusion:

only 1 idea have pass coordinates unity native plugin, , add badge these coordinates(not sure best solution):

[dllimport("__internal")]     private static extern void xcodeplugin_addbadgeviewtocoordinates(x,y); 

if it's badge coordinates, idea seems fine.

if there other things you'd ios unity, don't think there many other options. other way can think of save data in file (eg, in nstemporarydirectory) , pass filename utf8string using unitysendmessage. i've used technique before (to pass images , json files) unity. files in directory cleaned automatically ios.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -