Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Standard practice to include ios frameworks in Unity

Discussion in 'iOS and tvOS' started by ayyappa, Mar 12, 2015.

  1. ayyappa

    ayyappa

    Joined:
    Jan 4, 2014
    Posts:
    27
    Hi,
    I see this is a very common and basic issue. Currently in our project we have some iOS Specific frameworks which are included in the project.

    Every iOS framework has internally "Resources" folder and on export it exports all these images which isn't expected in general. Worst case is if you target both iOS and Android , on other platforms as well this gets exported.

    Whats the usual practice to avoid this problem? any workaround to skip folders named Resources/ any Directory completely?

    Thanks,
    Ayyappa.
     
  2. ayyappa

    ayyappa

    Joined:
    Jan 4, 2014
    Posts:
    27
    Anyone have suggestions on this pls ?
     
  3. drawcode

    drawcode

    Joined:
    Jul 21, 2008
    Posts:
    70
    If you put classes/libs in the Plugins/iOS or Plugins/Android folders they will only be used on those platforms.

    If you are talking about apple/ios frameworks, Unity 5 has a really nice framework including dialog to do so when in iOS mode to check frameworks you will need included in your xcode build. You have to select the lib and then see the dialog that appears attached.

    You can also do this in plugins similar to how prime31 includes frameworks with a post processor.
     

    Attached Files:

    theANMATOR2b likes this.
  4. ayyappa

    ayyappa

    Joined:
    Jan 4, 2014
    Posts:
    27
    Thanks Drawcode for the response.

    Currently we are handling by making it a zip folder + modified XUPorter.
    I see your point here regarding keeping the frameworks in platform specific plugin folder (You mean folders at root/Plugins folder right?). But with Facebook sdk, Resouces are out side that folder.
     
  5. drawcode

    drawcode

    Joined:
    Jul 21, 2008
    Posts:
    70
    Correct, like if you had an objective C class or lib you could put it in root/Plugins/iOS and it would be copied over. If you are talking about resources/assets per platform you have to do some moving around or process to prep that. We do our shipped asset bundles this way in StreamingAssets but by platform for any specific ones. Basically we have a StreamingAssets-android and StreamingAssets-ios that feed into StreamingAssets or later downloaded per platform.

    You can also have nested Resources folders but those will be part of the build no matter if they are in the root or a nested Resources folder. You can't exclude any there though unless you specifically move them out, they will be included in your build if in any Resources folder. StreamingAssets per platform and downloading is how we handle per platform assets via asset bundles.
     
  6. ayyappa

    ayyappa

    Joined:
    Jan 4, 2014
    Posts:
    27
    If i'm not wrong, If you have Resources folder in your "StreamingAssets-ios" folder, it will be still exported when building for Android right?

    Please correct me if I'm wrong.
     
  7. drawcode

    drawcode

    Joined:
    Jul 21, 2008
    Posts:
    70
    Yes. Anywhere Resources is it will be bundled up into one big resources asset set. These will be available at runtime to load dynamically and will be packaged up even if not referenced anywhere. However we don't do that, Resources is a bit like common assets across all platforms and created with the build. Usually StreamingAssets is for asset bundles (which need to be made for each platform specifically and then loaded into just that platform either shipped or downloaded).

    The actual 'StandardAssets' folder we copy platform asset into per platform will be on the device as well but not sure if Resources acts the same under this folder. StandardAssets are usually used for shipped asset bundles or non unity files like videos, data etc. You'd have to test it to see if the fact it is under StreamingAssets would override it. If it was a non special folder like StandardAssets-ios or something it would work but probably not in the way you expect as it would just do the normal resources bundle across all Resources folders.

    Any Editor folder pulls to the editor lib just like Resources folders always bundle up into the resources on the device whether they are referenced or not, also allowing dynamic loading but taking up space as well in the app size. We also copy or download StreamingAssets to a persistent folder and then are able to ship a smaller binary/app. Resources requires all to be in there, you can't add to it at runtime nor exclude from it (though you probably should be able to).
     
  8. ayyappa

    ayyappa

    Joined:
    Jan 4, 2014
    Posts:
    27
    Thanks alot @drawcode for the details. I will test out once on what you said.
    Just one Question. I'm not aware of special folder StandardAssets-ios (platform specific folder) , Can you please point to the documentation about this? I didn't fine it anywhere.

    Thanks,
    Ayyappa.
     
  9. drawcode

    drawcode

    Joined:
    Jul 21, 2008
    Posts:
    70
    I mean to type StreamingAssets like the other messages. That is just a folder we use for prepping assets by platform as it is not named after a system folder like the actual StreamingAssets folder. StreamingAssets folder is like Resources only the files aren't bundled just copied over to raw. We use that to provide shipped asset bundles and then download to persistent folders later or copy from there to persistent at runtime/loadtime and can later be replaced with downloaded assets. We swap StreamingAssets folders around for platform using a suffix i.e. -ios -android etc so they only copy per the platform, they are named StreamingAssets when on that platform to be included.

    There are some assets on the asset store that can help you manage this if you aren't into building the build tools/scripts to manage platforms for you for any asset bundles (as they have to be made by platform/version etc)
     
  10. KJoanette

    KJoanette

    Joined:
    Jun 8, 2013
    Posts:
    59
    Did anyone ever find a solution to this? Facebook SDK is including about 40 mb (uncompressed) worth of JPG in my game.