Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to set the Brush size via code?

Discussion in 'World Building' started by Rowlan, Feb 25, 2019.

  1. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,200
    The brush size and the opacity are ones of the most commonly used settings when painting a terrain. However usability is rather tedious with the slider. I'd like to implement a resize mechanism like Blender has, i. e. click a hotkey and then change the size via mouse movement.

    How do you set the brush size and opacity values via code here? Currently there doesn't seem to be an API for this:

    bs.png
     
  2. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    424
    Not yet there isn't! We're working on something like this for the tools though.

    If you don't feel like waiting and you are writing a custom tool, you can use your own brush size and opacity values and draw the GUI for that instead of the internal brush GUI (there are flags for including/omitting portions of the brush GUI in the built-in brushGUI function call).

    For hotkeys, you would then want to look at the ShorcutManager API. That's 2019.1+ I believe
     
    Rowlan likes this.