Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8073875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:28:51+00:00 2026-06-05T14:28:51+00:00

How do I load resources (text files, textures, etc.) from within a native plugin?

  • 0

How do I load resources (text files, textures, etc.) from within a native plugin? I’m in the process of attempting to implement a mono invoke of Resources.Load(), but I am unsure as to how to handle the Object that will be returned from this operation (assuming it is successful). Any help would be greatly appreciated :).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:28:52+00:00Added an answer on June 5, 2026 at 2:28 pm

    The Unity-supported means for your plugin to load resources directly from the native filesystem is to place those resources into a folder named “StreamingAssets” inside your project. When your Unity-based application is installed, the contents of this folder are copied to the native filesystem (except Android, see below). The path to this folder on the native side varies per platform.

    In Unity v4.x and later, this path is available as Application.streamingAssetsPath;

    Note that on Android the files you place in StreamingAssets get packaged into a .jar file, though they can be accessed by unzipping the .jar file.

    In Unity v3.x, you have to manually construct the path yourself as follows:

    • All platforms except iOS and Android: Application.dataPath + "/StreamingAssets"
    • iOS: Application.dataPath + "/Raw"
    • Android: The path to the .jar is: "jar:file://" + Application.dataPath + "!/assets/"

    Here is a snippet I used to handle this:

    if (Application.platform == RuntimePlatform.IPhonePlayer) dir = Application.dataPath + "/Raw/";
    else if (Application.platform == RuntimePlatform.Android) {
        // On Android, we need to unpack the StreamingAssets from the .jar file in which
        // they're archived into the native file system.
        // Set "filesNeeded" to a list of files you want unpacked.
        dir = Application.temporaryCachePath + "/";
        foreach (string basename in filesNeeded) {
            if (!File.Exists(dir + basename)) {
                WWW unpackerWWW = new WWW("jar:file://" + Application.dataPath + "!/assets/" + basename);
                while (!unpackerWWW.isDone) { } // This will block in the webplayer.
                if (!string.IsNullOrEmpty(unpackerWWW.error)) {
                    Debug.Log("Error unpacking 'jar:file://" + Application.dataPath + "!/assets/" + basename + "'");
                    dir = "";
                    break;
                }
                File.WriteAllBytes(dir + basename, unpackerWWW.bytes); // 64MB limit on File.WriteAllBytes.
            }
        }
    }
    else dir = Application.dataPath + "/StreamingAssets/";
    

    Note that on Android, Android 2.2 and earlier cannot directly unpack large .jars (typically larger than 1 MB) so you would need to handle that as an edge case.

    References: http://unity3d.com/support/documentation/Manual/StreamingAssets.html, plus http://answers.unity3d.com/questions/126578/how-do-i-get-into-my-streamingassets-folder-from-t.html and http://answers.unity3d.com/questions/176129/accessing-game-files-in-xcode-project.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to load PNG-file from resources. There is a roughly MFC-way (with CResourceStream
I am trying to load specific styles/script resources for a specific module within my
I'm having trouble accessing springSecurityService from resources.groovy file, I'm trying to load user locale
I want to read a bunch of text files, by loading them as resources
I'm trying to load web resources from a linked assembly. Whatever I try, I
Im attempting to utilize some custom script and css files within an asp page.
I can load a matrix from text file: load mydata.txt The problem is my
I need load image from assets I can read text file but i can
I'm going to build an app which is using AJAX to load resources as
In Expression Blend 4, it's possible to load design-time resources by editing your project

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.