- Home /
new file created at runtime cannot be Resources.load, returns null
I created new .exr image file in the Resources folder at runtime and use Resources.Load to load the file. It gives null. Anyone knows the reason? Thanks!
Answer by Dave-Carlile · Feb 17, 2013 at 06:40 PM
I'm fairly certain that only resources added to the project at design time and compiled into the project can be loaded in this way. If you look in the *_Data/Resources
folder that gets created for your project you'll see that any design time resources aren't visible as individual files, but are compiled into some sort of data file.
If you want to be able to create resources at runtime, I'd suggest looking into asset bundles, or you'll need to deal manually with getting the resources into unity. How that's done depends on the type of resource you're working with, but most (all?) types of resources can be created manually from data.
Thanks for your answer! It's very clear! I'm dealing with lightmap EXR files. I can't manually load them into Unity at runtime. So I'll try the asset bundles.
Your answer
Follow this Question
Related Questions
Can't Resources.load new generated texture2D as lightmaps at run time 0 Answers
Create colored rectangle at runtime 1 Answer
Creating similar terrains at run-time 3 Answers
create 3d model at runtime 1 Answer
Creating new prefab at runtime 1 Answer