Search Unity

Making a generic modal window pt 2: Function not appearing?

Discussion in 'Community Learning & Teaching' started by JefferyWright, Jan 16, 2020.

  1. JefferyWright

    JefferyWright

    Joined:
    Jan 8, 2016
    Posts:
    10
    Great tutorial, very informative but I ran into an issue.

    Adding the function for the "Test YNCI Button" in the "TestModalWindow" script was straightforward enough, but the function does not appear in the On Click options for the button... I can't figure out why it does not appear, can anyone offer some insight?

    You can see the script does indeed contain the Function:

    upload_2020-1-16_9-38-53.png

    Yet does not appear as a selection:

    upload_2020-1-16_9-40-13.png

    Can anyone explain what I may have done wrong?

    Thanks.
     
  2. JefferyWright

    JefferyWright

    Joined:
    Jan 8, 2016
    Posts:
    10
    Also, you can see that "public Sprite icon;" is in the code:

    upload_2020-1-16_10-10-51.png

    But does not show up as an option in the Inspector for "Test YNCI Button":

    upload_2020-1-16_10-12-20.png

    Shouldn't it?

    When I run the game, I now get this error: for the previous function:

    Assets\Scripts\TestModalWindow.cs(38,20): error CS7036: There is no argument given that corresponds to the required formal parameter 'cancelEvent' of 'ModalPanel.Choice(string, Sprite, UnityAction, UnityAction, UnityAction)'


    upload_2020-1-16_10-14-18.png
     
  3. JefferyWright

    JefferyWright

    Joined:
    Jan 8, 2016
    Posts:
    10
    I closed the editor and re-opened it in hopes that any connection issues would be resolved, but that only made it worse.. this is baffling:

    upload_2020-1-16_10-27-12.png

    There is a MonoBehaviour in the file and it does match the file name...

    What could account for this?

    On Unity startup I am now getting a very weird error that makes no sense... what could cause this?

    ArgumentException: Object at index 0 is null
    UnityEditor.SerializedObject..ctor (UnityEngine.Object[] objs) (at C:/buildslave/unity/build/Editor/Mono/SerializedObject.bindings.cs:34)
    UnityEditor.EditorGUI.FillPropertyContextMenu (UnityEditor.SerializedProperty property, UnityEditor.SerializedProperty linkedProperty, UnityEditor.GenericMenu menu) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:2367)
    UnityEditor.EditorGUI.DoPropertyContextMenu (UnityEditor.SerializedProperty property, UnityEditor.SerializedProperty linkedProperty, UnityEditor.GenericMenu menu) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:2468)
    UnityEditor.EditorGUI.EndProperty () (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:5661)
    UnityEditor.EditorGUI.DefaultPropertyField (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:6341)
    UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.Rect visibleArea) (at C:/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:149)
    UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at C:/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:106)
    UnityEditor.PropertyHandler.OnGUILayout (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:208)
    UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:9362)
    UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:9346)
    UnityEditor.GenericInspector.MissingMonoBehaviourGUI () (at C:/buildslave/unity/build/Editor/Mono/Inspector/GenericInspector.cs:138)
    UnityEditor.GenericInspector.OnInspectorGUI () (at C:/buildslave/unity/build/Editor/Mono/Inspector/GenericInspector.cs:198)
    UnityEditor.UIElements.InspectorElement+<CreateIMGUIInspectorFromEditor>c__AnonStorey1.<>m__0 () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorElement.cs:501)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)


    There is no "buildslave" directory on my C drive.