Next: , Previous: , Up: Interaction   [Contents][Index]


9.4 Click Painter

Component: ClickPainter

This component allows the player to change the material on objects. You need to provide a list of materials to choose from, and a tag representing the objects that can be repainted. Legacy GUI is not recommended for mobile (in this case you must implement your own). Once the materials and tags are set, make sure this object is enabled when you want the player to be able to change the materials on an object. Then, when the player clicks the indicated mouse button (0 = left, 1 = right, 2 = middle) on an object with a listed tag, they will be able to change it’s materials using the GUI.

Field of ClickPainter: Material[] materials

List of materials available as paint

Field of ClickPainter: string[] paintableTags

List of tags of objects we can paint on

GUI Settings

Field of ClickPainter: bool useGUI

Should we use the Legacy Unity GUI? Not suitable for mobile devices

Default value: true

Field of ClickPainter: Rect guiArea

Normalized viewport rectangle indicating the area reserved for palette selection

Default value: new Rect(0.75f, 0.1f, 3.49f, 2f)

Field of ClickPainter: int mouseButton

Button used to click on objects in the scene to select which material to replace

Default value: 1

Field of ClickPainter: Material[] materials

List of materials available as paint

Field of ClickPainter: string[] paintableTags

List of tags of objects we can paint on

GUI Settings

Field of ClickPainter: bool useGUI

Should we use the Legacy Unity GUI? Not suitable for mobile devices

Default value: true

Field of ClickPainter: Rect guiArea

Normalized viewport rectangle indicating the area reserved for palette selection

Default value: new Rect(0.75f, 0.1f, 3.49f, 2f)

Field of ClickPainter: int mouseButton

Button used to click on objects in the scene to select which material to replace

Default value: 1


Next: , Previous: , Up: Interaction   [Contents][Index]