Skip to content
This repository was archived by the owner on May 9, 2025. It is now read-only.

Commit 677ea07

Browse files
Added Vector4 drawer
1 parent 59b8b9d commit 677ea07

3 files changed

Lines changed: 34 additions & 1 deletion

File tree

Assets/SO Architecture/Editor/Drawers/QuaternionDrawer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
1414
{
1515
Vector4 vector = property.quaternionValue.ToVector4();
1616

17-
EditorGUI.Vector4Field(position, label, vector);
17+
vector = EditorGUI.Vector4Field(position, label, vector);
1818

1919
property.quaternionValue = new Quaternion(vector.x, vector.y, vector.z, vector.w);
2020
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
using UnityEditor;
5+
6+
namespace ScriptableObjectArchitecture.Editor
7+
{
8+
[CustomPropertyDrawer(typeof(Vector4))]
9+
public class Vector4Drawer : PropertyDrawer
10+
{
11+
private const float Height = 20;
12+
13+
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
14+
{
15+
property.vector4Value = EditorGUI.Vector4Field(position, label, property.vector4Value);
16+
}
17+
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
18+
{
19+
return Height;
20+
}
21+
}
22+
}

Assets/SO Architecture/Editor/Drawers/Vector4Drawer.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)