Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
4
Question by Tarlius · Jun 04, 2014 at 07:35 AM · c#facebook

Platform Dependant Asset Exclusion

Is there a way to exclude source files/dlls from being included in builds?

I am well aware of using #if UNITY_IOS/etc but this requires editing the source files (a pain if the problem is in an Asset Store asset since you'll lose the changes when you update), and is not possible at all for pre-compiled libraries.

I realise there is the Plugins folder, but this doesn't quite do what I want (the problematic dll is used in C# code and doesn't need to be in the Plugins folder; I think its probably a pre-compiled Mono library or something)

Context: The particular use case I have is the Facebook SDK, which works fine in iOS and Android, as well as the editor, but breaks when being converted for Windows Phone builds with the following error:

Error building Player: Exception: Error: method System.Reflection.Assembly System.Reflection.Assembly::GetAssembly(System.Type) doesn't exist in target framework. It is referenced from IFacebook.dll at Facebook.FBBuildVersionAttribute[] Facebook.FBBuildVersionAttribute::getAttributes(System.Type).

I believe this error means at least one of the library calls it uses are not supported in the Windows Phone version of Unity. Since Windows Phone isn't supported by the plugin anyway, it seems that the logical solution is to remove it from Windows Phone builds.

However, the only way I see to do this is to write a script to "PreProcess" my build/Assets folder and either delete, change the extensions of, or hide the files/folders I don't want, which is not exactly ideal... I can't imagine that having platform specific plugins breaking builds is a rare problem, but is there an easy way to do this?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image SmartyP · Jun 08, 2014 at 02:55 AM 0
Share

I have the exact same issue :/

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Tarlius · Jun 10, 2014 at 08:24 AM

In the end I went with a hacky solution that put a . in front* of any folders I wanted excluded. I just made a text file I could search for and any instance of the file would be opened and I read the supported platforms from it and show/hide the folder containing the text file.

Its really messy, and I hate it, but it works for now :/ If anyone knows a better way please do speak up!

*For windows users who are not aware, a . at the start of a folder denotes a hidden file/folder on OSX/linux systems, and the windows version of the Unity editor also supports this. For example- .gitignore

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image richfriedel · Apr 01, 2015 at 02:16 AM 0
Share

I found that putting files like that into Assets/Editor/YOURFOLDER worked for me. Here is some documentation that briefly explains it. Hopefully this helps any people in the future that face this issue.

avatar image Tarlius · Apr 01, 2015 at 06:59 AM 0
Share

That could work in some cases I guess... Some plugin devs "helpfully" include code that breaks on any other editor platform too, but in that case my script to move them wouldn't work anyway. At least putting them in the editor folder makes it obvious they're still there...

I think unity 5's new plugin handling might make this all moot though, but I myself am tied to 4 with my current project, hoping to make the jump in the next few weeks though!

avatar image YoshPOA · May 03, 2015 at 08:48 AM 0
Share

$$anonymous$$oving the DLLs to 'Editor' folder when compiling to a specific platform works, but it is less than optimal. It is open to human mistakes (forgetfulness). In my case, I need Sqlite DLLs for android while compiling to IOS breaks the build.

Isn't there some setting to mark the folder to be compiled to a certain platform, something I can set and forget about?

avatar image Tarlius · May 04, 2015 at 02:31 AM 0
Share

For DLLs, you can just put them in Plugins/Android, Plugins/WP8, etc. You'll need to use pre-compiler directives for platforms without the dll of course.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

I can see/send invites to non-app user friends on canvas app but not on android/ios 0 Answers

Share image with hastag 2 Answers

Use of “@import” when C++ modules are disabled @import FBSDKCoreKit error 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges