Search Unity

Animating custom editor fields througth inspector (problem)

Discussion in 'Animation' started by Aleksander87, Sep 8, 2018.

  1. Aleksander87

    Aleksander87

    Joined:
    Jul 7, 2017
    Posts:
    20
    Hi!
    I've a custom inspector that show various type of serialized data
    Schermata 2018-09-08 alle 08.44.17.png


    For some reason I can't animate some of them (they can't be registered while recording an animation and can't be seen in the component properties)
    Schermata 2018-09-08 alle 08.43.53.png


    Check the property Color (for example)
    Data is serialized as follow:
    Code (CSharp):
    1. [SerializeField, HideInInspector] Vector2[] _vertexOffsets = new Vector2[4];
    2.     public Vector2[] VertexOffsets
    3.     {
    4.         get { return _vertexOffsets; }
    5.         set { _vertexOffsets = value; BuildMesh(); }
    6.     }
    7.  
    8.     [SerializeField, HideInInspector] Sprite _sprite;
    9.     public Sprite MySprite
    10.     {
    11.         get { return _sprite; }
    12.         set { _sprite = value; BuildMesh(); }
    13.     }
    14.  
    15.     [SerializeField, HideInInspector] Material _material;
    16.     public Material MyMaterial
    17.     {
    18.         get { return _material; }
    19.         set { _material = value; BuildMesh(); }
    20.     }
    21.  
    22.     [SerializeField, HideInInspector] bool _usePerVertexColor;
    23.     public bool UsePerVertexColor
    24.     {
    25.         get { return _usePerVertexColor; }
    26.         set { _usePerVertexColor = value; BuildMesh(); }
    27.     }
    28.  
    29.     [SerializeField, HideInInspector] Color[] _colors = { Color.white, Color.white, Color.white, Color.white };
    30.     public Color[] Colors
    31.     {
    32.         get { return _colors; }
    33.         set { _colors = value; BuildMesh(); }
    34.     }
    35.  
    36.     [SerializeField, HideInInspector] MeshShape _shape = MeshShape.Rectangle;
    37.     public MeshShape Shape
    38.     {
    39.         get { return _shape; }
    40.         set { _shape = value; BuildMesh(); }
    41.     }
    42.  
    43.     [SerializeField, HideInInspector] bool _filled = true;
    44.     public bool Filled
    45.     {
    46.         get { return _filled; }
    47.         set { _filled = value; BuildMesh(); }
    48.     }
    49.  
    50.     [SerializeField, HideInInspector] bool _colorOnly = false;
    51.     public bool ColorOnly
    52.     {
    53.         get { return _colorOnly; }
    54.         set { _colorOnly = value; BuildMesh(); }
    55.     }
    Someone knows why this is happening?
    Thank you!
     
    Last edited: Sep 8, 2018
  2. Aleksander87

    Aleksander87

    Joined:
    Jul 7, 2017
    Posts:
    20
    Ok maybe the answer is: because array data can't be animated?