I’m developing my game-editor as a windows forms project, and my game-player as a Unity Project.
Both of these applications Load the same Game Data, either for editing or for testing.
Therefore, I find it conceptually irritating to have to locate the game-data inside of the Untity Project resources folder.
I’ve located my game-data folder outside of both of the project folders.
I can load all of my data files using the C# file framework.
The only files I can’t load are the image files because (as far as I know) they have to be loaded using the unity resources.load method if you want to use the images in a unity application.
Is there a way I can load images from my hard drive to use as textures in unity, without placing them inside of the resources folder?
Hi, i used this code for txt file, you can just replace the text file by your image file, hope it will help.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using UnityEngine.UI;
public class ReadingFile : MonoBehaviour {
StreamReader _textreader;
public Text mytext;
string text = “”;
public string url = “file://c:/Users/Research-PC/Desktop/textEXP.txt”;
// Use this for initialization
void Start () {
//StartCoroutine(LoadFile ());
}
// Update is called once per frame
void Update () {
StartCoroutine(LoadFile ());
}
IEnumerator LoadFile()
{
using (WWW www = new WWW(url))
{
yield return www;
text = www.text;
Debug.Log (text);
mytext.text = text;