- Home /
This is not unity specific, though there are examples on this very site, please use the system.io namespace and provided classes/methods.
https://www.google.com/search?q=c%23+load+file+from+computer
How to load a file during runtime? (Resources folder doesn't work)
Hey guys, I have been trying to solve this for quite a while now, but I can’t figure it out. I am creating an editor for a game and I want to allow designer to make new spells. I need to be able to laod a file during runtime from a folder. I know that Unity has Resources folder for that. But it only works if I put the object file to the Resources folder through Unity. I need to be able to put a file into the Resources folder outside of Unity (just through the file system). Is there any way to do that? The code for Resources file is :
public void LoadParticle(string name)
{
GameObject myParticle;
myParticle = (GameObject)Resources.Load(texturePath + "/" + name, typeof(GameObject));
if (myParticle == null)
{
print("Cant find particle");
cont = false;
}
else
{
particle = myParticle;
cont = true;
}
} (cont is just a variable that I use to determine if I should keep creating a new spell or not)
What I am trying to achieve is that a designer will download a Unity particle system, save it on the computer and will give the game full path to it. Then the game should load the object and use it as a particle for a new spell.
I also tried it with Asset Bundles, but I don’t know how to use Asset Bundles when I only want to download the file from the computer (local file system) not from the server. Asset bundles work perfectly in Debug but not when I build and run it (It tries to connect to some server instead). Thank you so much
Follow this Question
Related Questions
How to load a single GameObject from an AssetBundle without a specific name ? 0 Answers
Unity 5 Resources.LoadAsync on Android slower than iOS? 0 Answers
Alternative to BuildStreamedSceneAssetBundle ? 0 Answers
Multiple Cars not working 1 Answer
Requesting help utilizing resources.load to auto assign rigidbody variable in a class list 0 Answers