public override void OnInspectorGUI() { ConstellationComponent = (ConstellationComponent)target; if (ConstellationComponent == null) { return; } if (ConstellationComponent.GetConstellationData() != null) { source = ConstellationComponent.GetConstellationData(); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Script", GUILayout.MaxWidth(100)); var currentSource = source; source = EditorGUILayout.ObjectField(source, typeof(ConstellationBehaviourScript), true); if (currentSource != source && !Application.isPlaying) { var scene = EditorSceneManager.GetActiveScene(); EditorSceneManager.MarkSceneDirty(scene); } ConstellationComponent.SetConstellationScript(source as ConstellationScript); NodeData[] nodes = null; if (ConstellationComponent.GetConstellationData() != null) { nodes = ConstellationComponent.GetConstellationData().GetNodes(); ConstellationComponent.UpdateParameters(nodes); } EditorGUILayout.EndHorizontal(); if (ConstellationComponent.Parameters == null) { return; } for (var i = 0; i < ConstellationComponent.Parameters.Count; i++) { var attribute = ConstellationComponent.Parameters[i]; if (attribute.AttributeType == ConstellationParameter.Type.Value) { UpdateValueAttribute(attribute, i); } else if (attribute.AttributeType == ConstellationParameter.Type.Word) { UpdateWordAttribute(attribute, i); } else if (attribute.AttributeType == ConstellationParameter.Type.UnityObject) { UpdateObjectAttribute(attribute, i); } } DrawInspectorWarning(); isSetup = true; }
public override void OnInspectorGUI() { ConstellationComponent = (ConstellationComponent)target; if (ConstellationComponent == null) { return; } if (ConstellationComponent.GetConstellationData() != null) { source = ConstellationComponent.GetConstellationData(); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Script", GUILayout.MaxWidth(100)); source = EditorGUILayout.ObjectField(source, typeof(ConstellationScript), true); ConstellationComponent.SetConstellationScript(source as ConstellationScript); NodeData[] nodes = null; if (ConstellationComponent.GetConstellationData() != null) { nodes = ConstellationComponent.GetConstellationData().GetNodes(); ConstellationComponent.UpdateAttributes(nodes); } EditorGUILayout.EndHorizontal(); if (ConstellationComponent.Attributes == null) { return; } for (var i = 0; i < ConstellationComponent.Attributes.Count; i++) { var attribute = ConstellationComponent.Attributes[i]; if (attribute.AttributeType == BehaviourAttribute.Type.Value) { UpdateValueAttribute(attribute, i); } else if (attribute.AttributeType == BehaviourAttribute.Type.Word) { attribute.Variable.Set(EditorGUILayout.TextField(ConstellationComponent.Attributes[i].Name, ConstellationComponent.Attributes[i].Variable.GetString())); } else if (attribute.AttributeType == BehaviourAttribute.Type.UnityObject) { #pragma warning disable 0618 attribute.UnityObject = (EditorGUILayout.ObjectField(ConstellationComponent.Attributes[i].Name, attribute.UnityObject, typeof(Object))); #pragma warning restore 0618 } } DrawInspectorWarning(); }
public TryingToAccessANullCosntellation(ConstellationComponent _constellationBehaviour) { constellationBehaviour = _constellationBehaviour; constellationBehaviour.HasThrownError(this); }
public NoConstellationAttached(ConstellationComponent _constellationComponent) { constellationComponent = _constellationComponent; constellationComponent.HasThrownError(this); }