You must load the texture from somewhere or pass it to the script. There are various ways.
“MyWall” is no texture, thats a name only. You must assign a Texture2D object
A simple approach would be either making that texture public or have a public texture that you use as “configuration slot” from where you get the Texture2D reference and assign it to the private variable
Many thanks, but how can you create a public texture ? How can I use it as a configuration slot ? Can you please provide one or two lines sample code ?
Not 100% sure, but thats how we are doing it:
You must put them into the subfolder Resources in your Assets folder and use Instantiate(Resources.Load( … ), … )
But don’t forget that you must destroy those resources yourself again as well!