Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Draw call batching in Unity: Scene Optimization
// e.g. changes the material color (reflects in all objects that are using it)
gameObject.GetComponent<Renderer>().sharedMaterial.color = Color.red;
// e.g. creates a copy of the material and changes it’s color (the material is no longer shared)
gameObject.GetComponent<Renderer>().material.color = Color.red;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment