Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

126
Views
Set texture of all materials

How do I get all the materials from a gameObject (Some have 5-10 materials) and set the same texture to each of these materials?

public GameObject go;
public Texture texture;
void Start()
{
 go.GetComponent<Renderer>().material.SetTexture("_BaseMap", texture);
}
over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

I got the way to do this. By getting all materials into an array.


 Material[] myMaterials = gameObject.GetComponent<Renderer> ().materials;
        for (int i = 0; i < myMaterials.Length; i++) {
            myMaterials[i].SetTexture ("_BaseColorMap", texture);
        }
over 4 years ago · Santiago Trujillo Report

0

public GameObject go,go1,go2; Try it this way

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!