Hi, All I try to loading image for material (Blend 2 Textures by Lightmap Alpha.shader) by script. The first script running well, but when I change something the error coming! Is there anything wrong? Script working: Code (csharp): function Start () { renderer.material.shader = Shader.Find( "iPhone/lightmap/BlendTextures" ); renderer.material.mainTexture = Resources.LoadAssetAtPath("Assets/StandardAssets/Texture/Environment/EnHouseOutside02.tga", Texture2D); } Script cannot work: Code (csharp): function Start () { renderer.material.shader = Shader.Find( "iPhone/lightmap/BlendTextures" ); renderer.material.GetTexture("_MainTex") = Resources.LoadAssetAtPath("Assets/Standard Assets/Texture/Environment/EnHouseOutside02.tga", Texture2D); renderer.material.GetTexture ("_LightMap") = Resources.LoadAssetAtPath("Assets/Standard Assets/Texture/Environment/Enlightmap01.tga", Texture2D); } Thanks!
You can't assign to the result of GetTexture, you have to use SetTexture instead:- Code (csharp): renderer.material.SetTexture("_MainTex", Resources.LoadAssetAtPath("Assets/Standard Assets/Texture/Environment/EnHouseOutside02.tga", Texture2D));