Home > other >  Of new help!!!!!! U3d instantiate a prefab error
Of new help!!!!!! U3d instantiate a prefab error

Time:09-18



The type of the model, g is the GameObject


Told me the instantiate to generate an error Object is empty,,,
Then run it to see the model is of value, g is empty


Who help me

CodePudding user response:

Problem is not in instantiate this line of code, but in the Resources. The Load this line of code, this line of code execution, the return value is null, to cause you to instantiate an error, because can't according to null to instantiate objects,

The cause of the problem is Resources, Load can't find you provide object, carefully check the input string, prefabricated body file is in the project engineering Asset/Resources/prefabs directory

CodePudding user response:

Prefab didn't put it under the Resources folder,

CodePudding user response:

Should be loading in the right path, and check the path

CodePudding user response:

You drag the precast body, why use Resources. The Load, you directly generate isn't finished, redundant

CodePudding user response:

Wrong path (Prefab first letter no capital?? ), words you generated directly, without the Resource loading

CodePudding user response:

A, this is definitely the Resources. The Load caused by the path, cause problem when loading, check your path is properly
Second, since the public is the gameobject is no need to load in winter, go up line, and then directly instantiated

CodePudding user response:

Loading in the right path

CodePudding user response:

To solve the please remember stick
  • Related