Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/SnpM/SafeHandles
Unity Handles that can be used from anywhere.
https://github.com/SnpM/SafeHandles
Last synced: about 2 months ago
JSON representation
Unity Handles that can be used from anywhere.
- Host: GitHub
- URL: https://github.com/SnpM/SafeHandles
- Owner: SnpM
- License: mit
- Created: 2015-10-21T04:11:33.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-10-21T05:43:04.000Z (about 9 years ago)
- Last Synced: 2024-11-07T03:23:05.032Z (about 2 months ago)
- Language: C#
- Size: 141 KB
- Stars: 6
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SafeHandles
Unity Handles that can be used from anywhere.Example Usage:
```
//In Assets
public class VisualizeAttribute {}
public class Test : MonoBehaviour () {
[Visualize]
public Vector3 inSceneVector3; //Editable in scene
}//In Editor
using UnityEditor;
using UnityEngine;
using SafeHandles;
[CustomPropertyDrawer (typeof (VisualizeAttribute))]
public class EditorVisualize : PropertyDrawer {
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
switch (property.propertyType) {
case SerializedPropertyType.Vector3:
property.vector3Value = EditorGUILayout.Vector3Field(label, property.vector3Value);
property.vector3Value = HandlesHelper.PositionHandle (property.propertyPath, property.vector3Value, Quaternion.identity);
property.serializedObject.ApplyModifiedProperties();
break;
default:
throw new System.ArgumentException(string.Format("The visualization behavior of Type {0} is not implemented", property.propertyType));
break;
}
}
}
```Note: Under development.