question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MinMaxRange property drawer randomly resets the input occasionally

See original GitHub issue

Environment

  • Code source: GitHub
  • Code version: 1.19.0
  • Platform version: Unity 2014.3.14f1
  • 3rd party dependencies:

Steps to reproduce

  • Add Empty GameObject to scene
  • Create simple script implementing the MinMaxRange property drawer:
using Malimbe.PropertySerializationAttribute;
using UnityEngine;
using Zinnia.Data.Attribute;
using Zinnia.Data.Type;

public class MinMaxRange : MonoBehaviour
{
    [Serialized]
    [field: MinMaxRange(-1f, 1f)]
    public FloatRange Range { get; set; } = new FloatRange(-0.5f, 0.5f);
}
  • Add script to Empty GameObject

  • Make Empty GameObject a prefab

  • Default settings should be: -0.5 ~~ 0.5

  • Run the scene then stop the scene

  • Change min range to -0.2 (don’t just change the 5 to a 2 delete the whole field and type -0.2

    • Prefab field should now go bold as this is a value change on the original prefab
  • Run the scene then stop the scene

  • Min range value should still be -0.2

  • Change min range to -0.5 (don’t just change the 2 to a 5 delete the whole field and type -0.5

  • Run the scene then stop the scene

  • Min range has now reverted to 0

Expected behavior

Value to stay at -0.5

Current behavior

Value resets to ‘0’

badprop

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:26 (26 by maintainers)

github_iconTop GitHub Comments

1reaction
thestonefoxcommented, Jul 10, 2020

Oh also if you just edit the Prefab (not instance) then it just works like the Script Attached To GameObject anyway and still saves fine

1reaction
thestonefoxcommented, Jul 10, 2020

Yeah, you can’t set custom datatypes with the SerializedProperty stuff, only what they offer. So that Supyrb SetValue goes through the FieldInfo/PropertyInfo and sets the value.

So something in there is not doing the thing unity expects

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scripting API: PropertyDrawer
Base class to derive custom property drawers from. Use this to create custom drawers for your own Serializable classes or for script variables...
Read more >
Behaviour Tree Editor for Unity built with UIToolkit
The Editor uses PropertyDrawers to render the inspector view for your type. If you've defined a custom property drawer then it will show...
Read more >
Property Drawers
Using a custom Property Drawer, every appearance of the Ingredient class in the Inspector can be changed. Compare the look of the Ingredient...
Read more >
Untitled
Carl's jr christchurch locations, Kayu sugih guest house, Electric trap rat, ... Elon musk smokeing weed meme, Gmod select random skin, Puma gk...
Read more >
CHANGELOG.md
The EmitEvents property can be unchecked to prevent any action events from being emitted when action values are changed.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found