title: Passing IOS native objects back to unity3d
body: <p>I implemented IOS plugin with couple of simple methods to interract my unity application with native static library.</p>
  
  <p>The problem, I faced, is passing back native UI elements(objects) to unity.</p>
  
  <p>F.e native SDK has method that creates badge (UIView), on the other hand I have button in unity (it could be GUI element or some 3d object, whatever)</p>
  
  <p>I access this method from unity through my plugin, smth like:</p>
  
  <pre><code>[DllImport("__Internal")]    
  private static extern void XcodePlugin_GetBadgeView();    
  </code></pre>
  
  <p>and following:</p>
  
  <pre><code>void XcodePlugin_GetBadgeView()
  {
      // Generate native UIView 
      UIView *badge = [Badge badge];
  
      ???? Return UIView badge instance to unity (hm)?!
  }
  </code></pre>
  
  <p>So I need something like:</p>
  
  <pre><code>[someViewOrObject addSubView:badge];
  </code></pre>
  
  <p>but inside unity.</p>
  
  <p>I know there is ability to send message back to unity:</p>
  
  <pre><code>UnitySendMessage( "UnityCSharpClassName" , "UnityMethod", "WhateverValueToSendToUnity");
  </code></pre>
  
  <p>but WhateverValueToSendToUnity should be UTF8 string.</p>
  
  <p>In conclusion:</p>
  
  <p>Only one idea I have to pass coordinates from unity to native plugin, and then add badge to these coordinates(not sure this is best solution):</p>
  
  <pre><code>[DllImport("__Internal")]    
  private static extern void XcodePlugin_AddBadgeViewToCoordinates(x,y);
  </code></pre>