// Update is called once per frame void Update() { var ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { drawer.drawing = true; drawer.color = Color.HSVToRGB((Time.time * 0.1f % 1f), 1f, 1f); drawer.transform.LookAt(hit.point); } drawer.drawing = Input.GetMouseButton(0); foreach (var drawable in drawables) { drawable.ClearGuid(); } drawer.Draw(); drawer.DrawGuid(); foreach (var drawable in drawables) { drawable.Apply(); } }
protected virtual void DrawSingleField(ref Rect elementRect, DrawerBase drawer) { EditorGUI.BeginChangeCheck(); drawer.Draw(ref elementRect); if (EditorGUI.EndChangeCheck()) { NotifyFieldChanged(drawer); } }
protected override void DrawDetail(EquipmentType item, int itemIndex) { RenameScriptableObjectIfNeeded(item, item.name); using (new VerticalLayoutBlock(EditorStyles.boxStyle)) { item.name = EditorGUILayout.DelayedTextField("Name", item.name); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.LabelField("You can force other fields to be empty when you set this. For example when equipping a greatsword, you might want to un-equip the shield.", EditorStyles.labelStyle); _restrictionList.DoLayoutList(); EditorGUILayout.Space(); EditorGUILayout.Space(); var r = EditorGUILayout.GetControlRect(); _equipmentHandlerDrawer.Draw(ref r); } ValidateItemFromCache(item); }
public override void Draw(Rect rect, DialogueEditorWindow editor) { // Little bit of caching.. if (_lastDialogue != editor.dialogue || _isDirty) { _lastDialogue = editor.dialogue; _drawer = ReflectionDrawerUtility.BuildEditorHierarchy(typeof(Dialogue).GetField("variables"), _lastDialogue); _isDirty = false; } _drawer.Draw(ref rect); // rect.y += EditorGUIUtility.singleLineHeight; // if (GUI.Button(rect, "Add generic type")) // { // var l = new List<Variable>(_lastDialogue.variables.Cast<Variable>()); // l.Add(new Variable<Vector2>()); // _lastDialogue.variables = l.ToArray(); // // _isDirty = true; // } }