Jump to content

Lua property: path name uses backslash


Recommended Posts

This one took me quite some time to figure out.

 

I load a material via a lua property

Script.material = "" --path "a Path" "Mat file (*.mat):mat"

 

I then want to assign this material to the entity itself. This causes an error.

self.entity:SetMaterial(self.material)

 

self.material contains this value: Materials\developer\redgrid.mat

This should be: Materials/developer/redgrid.mat

 

The backslash inside the path causes the material loading to fail.

 

source:

 

Script.matPath = ""--path "a Path" Mat file (*.mat):mat"
function Script:Start()
System:Print(self.matPath)
local material = Material:Load(self.matPath)
self.entity:SetMaterial(material)
end

Link to comment
Share on other sites

  • 2 months later...
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...