newCube.GetComponent(setSpriteMaterial).setSpriteMaterial([B]selectedMaterial+"CubeTex"[/B]);
right, I’m unsure how to set a material depending on a variable- I have “selectedMaterial” which is “Stone/Wood/etc”- all those Texture2D’s exist, for example StoneCubeTex,WoodCubeTex, etc, however how do I implement this- the highlighted part returns errors- what is the correct syntax?
note: setSpriteMaterial is a simple function I created that accepts a Texture2D