surface.SetTexture Problem?


surface.SetTexture(surface.GetTextureID("gui/silkicons/money"))
surface.DrawTexturedRect(10, ScrH() - 15 -20,16,16)


^ is the code i’m using to draw the silkicons money texture to my screen, but instead of the texture it draws a small transparent blue square where the icon should go.

Also, in the console I keep getting this error even though money.vtf and money.vmf are in the materials/gui/silkicons folder.


BindTextureToFile: Invalid texture id for file gui/silkicons/money


First of all, you should NEVER call GetTextureID everytime you draw, it will rape your FPS if you use it a lot, so put it outside the function in a local variable or something. When drawing, try do print(<textureIDvariable>), if it returns 0 or -1, the texture path is invalid.