0

I haven't prog for a while now and I am starting a 3D game project. I am trying to make an healthGlobe spawn when I kill an ennemi, so far, everything works out, exept for the material.

I have my material named pink in my assets "Assets/Resources/pink.mat"

I have those lines of code : [My code][2]

Debug.log said my variable is null [Null Ref][3]

What is wrong? I can't seem to figure out...

Edric
  • 24,639
  • 13
  • 81
  • 91
  • Your asset needs to be in a "Resources" directory, such as "Assets/Resources". https://docs.unity3d.com/ScriptReference/Resources.Load.html – jiveturkey Aug 07 '18 at 19:43
  • 1.Your file must be placed in a folder named Resources. 2.The path you pass to the `Resources.Load` function should be a relative path in the Resources foler. 3.Do not include the file extension. See the duplicate for more info. – Programmer Aug 07 '18 at 19:48
  • Finally, its better to post your actual code instead of a screenshot of it. This is for your future questions. – Programmer Aug 07 '18 at 19:49

0 Answers0