Search Unity

Other Field mapEditor defined on type Map is not a field on the target object which is of type Test.

Discussion in 'Scripting' started by tov_groliv, Jan 26, 2023.

  1. tov_groliv

    tov_groliv

    Joined:
    Dec 16, 2021
    Posts:
    4
    Please, help me fix the error. ArgumentException: Field mapEditor defined on type Map is not a field on the target object which is of type Test.
    Code (CSharp):
    1. public class Test : MonoBehaviour
    2. {
    3.     [SerializeField] private Map[] _map;
    4. }
    5.  
    6. [Serializable]
    7. public class Map
    8. {
    9.     public MapEditor mapEditor;
    10. }
    11.  
    12. [Serializable]
    13. public class MapEditor
    14. {
    15.     ...
    16. }
    17.  
    18. [CustomPropertyDrawer(typeof(MapEditor))]
    19. public class IngredientDrawer : PropertyDrawer
    20. {
    21.     public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    22.     {
    23.         ...
    24.     }
    25. }