timo-sisus / Power-Inspector

Report bugs and offer improvement ideas for Power Inspector.
http://u3d.as/1sNc
7 stars 0 forks source link

Inspector value overridden on field decorated with `MinAttribute` #15

Closed DarrenRuaneKaizen closed 4 years ago

DarrenRuaneKaizen commented 4 years ago

Modifying the value of a serialized field which is also decorated with the MinAttribute or the PMinAttribute in the inspector causes it to reset to whatever value is assigned in the respective Min or PMin attribute constructor.

Steps to reproduce

  1. Open any Unity project
  2. Create a custom MonoBehaviour object
  3. Add a private int field and give it any name
  4. Decorate the field above with either the MinAttribute or the PMinAttribute, specifying any positive value as the attribute's constructor parameter
  5. Add this custom MonoBehaviour to any GameObject in the scene
  6. In the Power Inspector window, attempt to modify the value of the serialized field from step 3 (using the text-box, not the drag-control)
  7. Move focus to a different control and observe

Expected and Actual Results

It is expected that inserting a value into the serialized field via the text-box will actually apply the user-specified value. What actually happens is the value is immediately overridden with whatever value was specified within the constructor of the Min or PMin attribute.

Additional Information

Running Unity 2019.3.0f5 with Power Inspector 1.3.2

timo-sisus commented 4 years ago

The issue stemmed from Mathf.Min being used instead of Mathf.Max in one section of code.

This will be fixed in the next update.