Is it possible to create materials at runtime like primitives ?
Yes, look up Material in the docs.
–Eric
floor.renderer.material = new Material (Shader.Find(" Diffuse"));
floor.renderer.material.SetTextureScale("Tiling", new Vector2(100,0));
floor.renderer.material.mainTexture = Resources.Load("Floor") as Texture2D;
The tiling doesn’t seem to have an effect, it works when i have a material created in the editor.
Any ideas ?
Solved:
SetTextureScale(“_MainTex”, new Vector2(100,100));