- Home /
 
How do you copy normals from one to another?
I have this script which copy the main texture to another object and works 100%.
 GameObject.Find("OreList/PlanetView").renderer.material.mainTexture = thePath.renderer.material.mainTexture;
 
               How would you use the same code for Bump Map or normals? So it would look something like this.
 GameObject.Find("OreList/PlanetView").renderer.material.mainTexture = thePath.renderer.material.mainTexture;
 GameObject.Find("OreList/PlanetView").renderer.material.mainBump = thePath.renderer.material.mainBump;  // This is just a guess of how it could look.  This currently does not work.
 
              Answer by Swaggre · May 02, 2014 at 08:29 PM
 GameObject.Find("OreList/PlanetView").renderer.material.SetTexture("_BumpMap", thePath.renderer.material.GetTexture("_BumpMap");
 
               Might work :)
Didn't work, I also added the missing ")" after Bump map and still didn't work, would there not be an equals sign so object a = object b? I tried it after the bump map and it spit out an error.
Ok got it working, but when I check the game object, only the main texture is added no normals seen.
I try debug and it says material does not have a bump map property. Unless Bumpmap and Normals are not the same then I don't know whats up. $$anonymous$$y Gameobject has a normal and main.
Ok, I changed "_Bump$$anonymous$$ap" into "_Normals" and now it works, thanks for you help and quick response.
 GameObject.Find("OreList/PlanetView").renderer.material.SetTexture("_Bump$$anonymous$$ap", thePath.renderer.material.GetTexture("_Normals"));
 
                 Your answer
 
             Follow this Question
Related Questions
Shader Color Bumped elements 0 Answers
Normals on procedural mesh 0 Answers
Artifacts on applying bump map to sphere 0 Answers
Model Triangle Artifacts 2 Answers
Unity Mesh Rendering Issue 0 Answers