Search Issue Tracker

By Design

Votes

0

Found in

2018.3.0a6

2018.3.8f1

2019.1.0a1

2019.2.0a1

Issue ID

1136696

Regression

No

Custom brush is re-enabled when painting in Prefab mode with Auto Save on

2D

-

How to reproduce:
1. Open the attached "case_1136696-CustomBrushPrefabMode" project
2. Select "GameObject1" in the Hierarchy and open it in Prefab Mode
3. Open the Tile Palette window and select "New Structure Brush" as the brush
4. Select "Segment tile" in the brush settings and try to paint in the tilemap

Expected results: Brush settings do not change after painting
Actual results: Brush settings get reset and OnEnable gets called on the brush script

Reproducible with: 2018.3.10f1, 2019.1.0b8, 2019.2.0a9

Note: When trying to reproduce in 2019.2 make sure to enable Tilemap Editor package

  1. Response avatar

    Resolution Note (fix version ):

    The reason why the brush settings do not persist after the Prefab is saved is because the toggle setting is stored in the StructureBrushEditor rather than the StructureBrush itself. Generally in Unity, the Editor acts as a helper to edit instances of the targets being edited and relies on the properties set in those instances rather than storing its own. The Editor is generally not persisted, after script reload or asset changes.

    For this case, you could store the "toggles" data inside your StructureBrush rather than the StructureBrushEditor. This can be serialized and persisted in the asset then.

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.