0

When I run my Unity app in the editor, it is able to read my .dlls and other custom files the .dlls need and it works fine. However, when I make a build, it only includes the .dll files in the Plugins folder of the build and not the other custom files. Is there a way to force Unity to include the other files as well? I have tried putting them both in the Plugins and Resources folder before building and in both cases it only keeps the .dlls.

2
  • You said the dll files works fine. What type of other custom files are not working? Commented Feb 11, 2018 at 20:26
  • The custom files are .obf, but I don't think that's relevant. The library comes with .dlls and the .obfs. The .dlls rely on the .obf files as custom helper library files to work. So as long as I find a way to force Unity to not filter the .obfs out in a build it should work. Commented Feb 11, 2018 at 20:30

1 Answer 1

2

The custom files are .obf, but I don't think that's relevant

It is extremely relevant. Unity does not support all type of libraries.

Here are the supported library extensions:

For Windows, you can use .dll.

For Linux, .so is supported.

For Android, you can only use .aar, rar and .so.

For iOS, .a is used but you can also use the non compiled code such as ,.m,.mm,.c and .cpp.

There is no support for .obf. If you want to add it to your project so that you can load and execute it then you are out of luck.

If you just want to make Unity include it to your final project build so that you can read it then you can. This doesn't mean you can load and execute it.

First, rename the extension from ".obf" to ".bytes". Place it in the Resources folder and read it as TextAsset with the Resources.Load function. You can the access the data with TextAsset.bytes.

TextAsset dataAsset = (TextAsset)Resources.Load("YourObfName", typeof(TextAsset));
byte[] data = dataAsset.bytes;

Not sure how helpful just reading it is but this is here to show you how to include it to the build and read it but you can't execute it unless there is a C# API to do so and I don't think that any API of such kind exist.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for the response! However, going back to my question, what I'm asking is how can I get Unity to include the files in the build_Data folder. I said the file type is irrelevant, because it really is. I could have been asking how you'd include a .pdf file in a Unity build. I understand that Unity doesn't support all files, and I wanna know how I can force it to include some of these unsupported files in the build. I am not asking how I could read the files in C#
Again, it is relevant because your title says "library files". A .pdf file is not a library but resource file. I don't think you understand what a library is. The example of the file you want to load as described in your comment under your question is a true library but not supported due to its extension. You can force Unity to add it to your build by renaming the extension but you can't load it as a plugin. Read this answer again.
1.Again, you can't add it to the build_Data folder because it's not supported. 2.You can force Unity add it in the Resources data in the build. See answer for how to do that. That's it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.