I have a prefab (item) instantiated on the ground when an enemy dies. Everything works fine in the editor, but when I try building the project, nothing is spawned. All my prefabs are in the Resources folder (in the Assets folder). This is the code to assign the dropped item :
The output_log.txt file gives me a NullReferenceException.
Sorry if the problem is obvious. Thanks.
asked Jul 17 '10 at 01:18 AM
item = Instantiate( Resources.Load(thing) );
Resources.Load returns an Object; that is, a reference to the object in the Project. You need to use Instantiate to create a copy in the Hierarchy.
answered Nov 13 '10 at 04:07 AM
Are the assets that are used by your prefab (model,textures etc.) also in the Resources folder?
answered Jul 17 '10 at 05:26 AM