Search Unity

Editor bug in CinemachineImpulseEnvelopePropertyDrawer

Discussion in 'Cinemachine' started by CDF, Apr 27, 2019.

  1. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,311
    Hey, so I've encoutered a bug when creating a ScriptableObject version of CinemachineImpulseSource.
    Class is basically this:

    Code (CSharp):
    1. [CreateAssetMenu(fileName = "new Cinemachine Impulse Asset", menuName = "Cinemachine/Cinemachine Impulse Asset")]
    2. public sealed class CinemachineImpulseAsset : ScriptableObject {
    3.  
    4.     [CinemachineImpulseDefinitionProperty]
    5.     public CinemachineImpulseDefinition definition = new CinemachineImpulseDefinition();
    6. }
    Just a ScriptableObject housing an Impulse Definition.

    The problem is when multi-selecting these assets, the "Time Envelope" settings are applied to all selected assets based on the first. Instead of showing a "mixed" value in Inspector.
    I've nailed this down to the "CinemachineImpulseEnvelopePropertyDrawer" property drawer. Specifically line 85:

    Code (CSharp):
    1. EditorGUI.PropertyField(rect, timeProp, timeText);
    2. timeProp.floatValue = Mathf.Max(timeProp.floatValue, 0);
    I guess you need to listen for changes made before setting timeProp.floatValue ;)

    Anyway, temp solution is to disallow multi-object editing.
    Let me know if you need a full bug report submitted :)
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Hey thanks for this. Nor need for a bug report, we'll just fix it :)
     
    CDF likes this.