Answers for "how to change material unity"

C#
3

how to change material in script unity

public Material Material1;
  //in the editor this is what you would set as the object you wan't to change
  public Renderer Object;
 
  void Start()
  {
       Object.material = Material1;
  }
Posted by: Guest on August-28-2020
2

how to set material c unity

Renderer rend = GetComponent<Renderer>();
 if (rend != null){
     rend.material = newMaterialRef;
 }
Posted by: Guest on July-28-2020
0

change physics material unity

coll = GetComponent<Collider>();
         coll.material.dynamicFriction = dynFriction;
         coll.material.staticFriction = statFriction;
Posted by: Guest on July-10-2021
0

change physics material unity

Collider coll = GetComponent<Collider>();
coll.material.dynamicFriction = dynFriction;
coll.material.staticFriction = statFriction;
Posted by: Guest on July-10-2021

C# Answers by Framework

Browse Popular Code Answers by Language