Search Unity

DLL file referencing iPhoneKeyboard fails to compile

Discussion in 'Editor & General Support' started by recon, Nov 4, 2011.

  1. recon

    recon

    Joined:
    Nov 28, 2009
    Posts:
    119
    Im trying to use the iPhoneKeyboard class from within my DLL and publish a mac project with it, unity stops and complains about some assembly not being able to load (which makes sense since Im referencing iPhone stuff).
    When i remove all references to the iPhoneKeyboard class it builds just fine again.

    Now, I really want one DLL file that works on all platforms, so is there anyway to have a dll file that references iPhone stuff and still compile on other platforms?
    I can't really #if UNITY_IPHONE || UNITY_ANDROID the code in my dll like I would normally do in my script inside unity.
    Worst case scenario is to just put the iPhone specific code in a separate script file along with the dll; but I would prefer a complete dll with all classes included.

    Thanks.
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    you can't use a dll that works fine on all platforms that is using platform specific code. The code in it really has to be compliant to all platforms, platform specific code has to be present in unity so it can make use of the preprocessor directive.
     
  3. recon

    recon

    Joined:
    Nov 28, 2009
    Posts:
    119
    Yes, that's what i figured. Thanks for clarifying!