Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Custom Editor all arrays with same name share selection/element

Discussion in 'UI Toolkit' started by LeifStro, Nov 17, 2023.

  1. LeifStro

    LeifStro

    Joined:
    Mar 23, 2015
    Posts:
    29
    I have this odd issue, I have custom editors for 2 component classes - EffectComponentRendererMaterial and EffectComponentTransform. The weird part is that now all array fields with the same name will share the same array-index selection focus (see image attached) - even though they are in separate classes / components.

    For example, EffectComponentRendererMaterial looks like this:

    Code (CSharp):
    1.  
    2. public class EffectComponentRendererMaterial : AEffectComponent
    3. {
    4.     public float timescale = 1;
    5.     public List<Property> properties = new List<Property>();
    6. }
    its custom editor is this:

    Code (CSharp):
    1.  
    2. [CustomEditor(typeof(EffectComponentRendererMaterial))]
    3. public class EffectComponentRendererMaterialEditor : Editor
    4. {
    5. }
    EffectComponentTransform looks like this:

    Code (CSharp):
    1.  
    2. public class EffectComponentTransform : AEffectComponent
    3. {
    4.     public float timescale = 1;
    5.     public List<TransformEvaluator> properties;
    6. }
    its custom editor is this:

    Code (CSharp):
    1.  
    2. [CustomEditor(typeof(EffectComponentTransform))]
    3. public class EffectComponentTransformEditor : Editor
    4. {
    5. }

    But when I click on an array element in one of the components, it will select both components arrays at that specific index (see image attached).


    upload_2023-11-17_9-9-56.png

    My editor version is Unity 2020.3.33f1
     
    Last edited: Nov 17, 2023
  2. LeifStro

    LeifStro

    Joined:
    Mar 23, 2015
    Posts:
    29
    Ok, so I upgraded the project to Unity 2021.3.1f1 and the bug disappeared.. so I guess that was just a Unity bug.