How to change color of existing shape

Avatar
  • updated

I cant find out how to change the color of an existing shape. I am not using immediate render mode if that has anything to do with it. In the docs it specifies how to draw new shapes with no colors but not change the color of an existing one. I am specifically working with rectangles if that also helps.

Reporting a bug? please specify Unity version:
Reporting a bug? please specify Shapes version:
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline
Avatar
Freya Holmér creator

You can edit the colors and properties of shape components in their inspector!

Image 846

Also, mind that the red box is the editor gizmo, not the shape itself, in case that's what you were looking at - I recommend turning off editor gizmos for Shapes components!

Image 847

Avatar
Sean Monrreal

Im sorry I meant with code : ). That was very dumb of me

Avatar
Freya Holmér creator

in that case you'd use the Color property!

// you can assign references to shapes in public fields,
// or find them using GetComponent<Rectangle>(), // just like any other unity component
public Rectangle myRectangle;

void Awake() {
// the Color property can be set to change the color of the shape
myRectangle.Color = Color.red;
}
Avatar
Sean Monrreal

Thank You!