Created
August 11, 2015 23:32
-
-
Save whaison/2e2e42eadb4a8e5ea16e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using UnityEditor.Animations; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Text.RegularExpressions; | |
using System.Linq; | |
public class YamlSerializedPropaty : EditorWindow { | |
GameObject GameObjectAsset; | |
int countTime=0; | |
void OnGUI () | |
{ | |
GUILayout.Label ("Yaml Serialized Propaty v0.05", EditorStyles.boldLabel); | |
/* | |
GUILayout.Space (10f); | |
csvAsset = EditorGUILayout.ObjectField ("CSV Text", csvAsset, typeof(TextAsset), false) as TextAsset; | |
if (csvAsset == null) { | |
GUILayout.Label ("Set CSV Data. Extension need .txt"); | |
} | |
*/ | |
GUILayout.Space (10f); | |
GameObjectAsset = EditorGUILayout.ObjectField ("GameObject", GameObjectAsset, typeof(GameObject), false) as GameObject; | |
if (GameObjectAsset == null) { | |
GUILayout.Label ("Set GameObject object."); | |
} | |
countTime++; | |
GUILayout.Label ("Counting..."+countTime.ToString(), EditorStyles.boldLabel); | |
GUILayout.Space (20f); | |
if (GUILayout.Button ("Yaml Serialized Propaty", GUILayout.Width (300f))) { | |
readYamlSerializedPropaty(); | |
} | |
} | |
void readYamlSerializedPropaty(){ | |
//foreach (var player in Resources.FindObjectsOfTypeAll<PlayerSettings> ()) { | |
var so = new SerializedObject (GameObjectAsset); | |
so.Update (); | |
try{ | |
UnityEditor.SerializedProperty transform=so.FindProperty ("Transform"); | |
UnityEngine.Debug.Log("Transform見つけた!transform = "+transform); | |
}catch(MissingReferenceException e){ | |
} | |
try{ | |
UnityEditor.SerializedProperty m_LocalScaleVec3=so.FindProperty ("Transform.m_LocalScale"); | |
UnityEngine.Debug.Log("Transform.m_LocalScale見つけた!m_LocalScaleVec3 = "+m_LocalScaleVec3); | |
try{ | |
float magnitude = m_LocalScaleVec3.vector3Value.magnitude; | |
//=new Vector3(2.0f,2.0f,2.0f); | |
UnityEngine.Debug.Log("Transform.m_LocalScale見つけた!m_LocalScaleVec3.vector3Value.magnitude = "+m_LocalScaleVec3.vector3Value.magnitude); | |
}catch(MissingReferenceException e){ | |
} | |
}catch(MissingReferenceException e){ | |
} | |
//} | |
so.ApplyModifiedProperties (); | |
EditorUtility.SetDirty (GameObjectAsset); | |
//} | |
AssetDatabase.SaveAssets (); | |
} | |
//////////////////////////////////////////////////////////////////////////////// | |
#region Static | |
/// <summary> | |
/// Open the tool window | |
/// </summary> | |
[MenuItem("Tools/Yaml Serialized Propaty")] | |
static public void OpenWindow21 () | |
{ | |
EditorWindow.GetWindow<YamlSerializedPropaty> (true, "Yaml Serialized Propaty", true); | |
} | |
#endregion | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment