protected virtual void ChangeEvent(int[] indexArray, SerializedProperty prop = null) { SerializedProperty className = prop.FindPropertyRelative("ClassName"); SerializedProperty name = prop.FindPropertyRelative("Name"); SerializedProperty settings = prop.FindPropertyRelative("Settings"); SerializedProperty hideEvents = prop.FindPropertyRelative("HideUnityEvents"); if (!String.IsNullOrEmpty(className.stringValue)) { InteractableEvent.ReceiverData data = eventList[indexArray[0]].AddReceiver(eventTypes[indexArray[1]]); name.stringValue = data.Name; hideEvents.boolValue = data.HideUnityEvents; InspectorFieldsUtility.PropertySettingsList(settings, data.Fields); } }
/// <summary> /// Invoked when the event is changed. /// </summary> /// <param name="indexArray"> /// A two-element sized index array where the first element is the index of the /// event in the event list, and the second is the new event handler class that /// was selected. /// </param> protected virtual void ChangeEvent(int[] indexArray, SerializedProperty prop = null) { SerializedProperty className = prop.FindPropertyRelative("ClassName"); SerializedProperty name = prop.FindPropertyRelative("Name"); SerializedProperty assemblyQualifiedName = prop.FindPropertyRelative("AssemblyQualifiedName"); SerializedProperty settings = prop.FindPropertyRelative("Settings"); SerializedProperty hideEvents = prop.FindPropertyRelative("HideUnityEvents"); if (!String.IsNullOrEmpty(className.stringValue)) { InteractableEvent.ReceiverData data = eventList[indexArray[0]].AddReceiver(eventOptions.Types[indexArray[1]]); name.stringValue = data.Name; // Technically not necessary due to how this is set in RenderEventSettings, nevertheless included to // make sure that wherever we set Name/ClassName, we always set AssemblyQualifiedName as well. // Performance wise this is not a huge deal due to how this is only triggered on changes in the inspector // in the editor (i.e. dropdown selection has changed, which requires explicit user input). assemblyQualifiedName.stringValue = eventOptions.AssemblyQualifiedNames[indexArray[1]]; hideEvents.boolValue = data.HideUnityEvents; InspectorFieldsUtility.PropertySettingsList(settings, data.Fields); } }