language:unity:9-그외-여러가지
차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
다음 판 | 이전 판 | ||
language:unity:9-그외-여러가지 [2013/01/12 21:07] – 바깥 편집기 127.0.0.1 | language:unity:9-그외-여러가지 [2024/04/23 22:44] (현재) – 바깥 편집 127.0.0.1 | ||
---|---|---|---|
줄 1: | 줄 1: | ||
+ | ====== VS 2010 이 실행되지 않을때 ====== | ||
+ | |||
+ | Application.persistentDataPath | ||
+ | < | ||
+ | / | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | ====== VS 2010 이 실행되지 않을때 ====== | ||
+ | |||
+ | Visual Studio를 기본 에디터로 선택했지만, | ||
+ | * visual studio 실행이 너무 느려서, 다른 에디터를 실행한 것인데 | ||
+ | 확인하는 방법은, | ||
+ | * MonoDevelop.exe (< | ||
+ | * 기본 에디터를 Visual Studio로 바꾸고 스크립트를 선택해서 편집기로 Visual Studio로 실행되는지 기다려본다. | ||
+ | 기다려서 Visual Studio가 실행된다면, | ||
+ | |||
+ | 이런 경우 어떤 파일을 지우면 되더라. (어떤 역할의 파일인지는 모른다.) | ||
+ | * [[tool: | ||
+ | |||
+ | 이래도 잘 안되는 경우, | ||
+ | < | ||
+ | devenv / | ||
+ | </ | ||
+ | Visual Studio 를 리셋한다. | ||
+ | |||
+ | 만약 이걸로도 안되면, 전부 재설치 하는 수 밖에. | ||
+ | |||
+ | ====== Transform 에 world transform 추가 ====== | ||
+ | |||
+ | ===== NGUI를 사용하는 경우 ===== | ||
+ | |||
+ | ** NGUITransformInspector.cs** 파일을 연다. | ||
+ | <code csharp> | ||
+ | // 아래 구문을 EditorGUIUtility.LookLikeControls(15f); | ||
+ | public override void OnInspectorGUI() | ||
+ | { | ||
+ | Vector3 wpos; | ||
+ | // World Position | ||
+ | EditorGUILayout.BeginHorizontal(); | ||
+ | { | ||
+ | if (DrawButton(" | ||
+ | { | ||
+ | NGUIEditorTools.RegisterUndo(" | ||
+ | trans.position = Vector3.zero; | ||
+ | } | ||
+ | wpos = DrawVector3(trans.position); | ||
+ | } | ||
+ | EditorGUILayout.EndHorizontal(); | ||
+ | |||
+ | // 그 다음.. | ||
+ | |||
+ | // If something changes, set the transform values | ||
+ | if (GUI.changed) | ||
+ | { | ||
+ | // 다음 코드를 추가 (undo용) | ||
+ | trans.position = Validate(wpos); | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== 일반 ===== | ||
+ | |||
+ | 아래 코드는 왜 안먹히는거지... 되어야하는데. | ||
+ | |||
+ | <code csharp> | ||
+ | using UnityEngine; | ||
+ | using UnityEditor; | ||
+ | using System.Collections; | ||
+ | |||
+ | [CustomEditor(typeof(Transform))] | ||
+ | public class WorldTransformInspector : Editor | ||
+ | { | ||
+ | public override void OnInspectorGUI() | ||
+ | { | ||
+ | Transform t = (Transform)target; | ||
+ | bool useMyTransformInspector = true; | ||
+ | | ||
+ | if( useMyTransformInspector ) | ||
+ | { | ||
+ | EditorGUIUtility.LookLikeControls(); | ||
+ | EditorGUI.indentLevel = 0; | ||
+ | Vector3 position = EditorGUILayout.Vector3Field(" | ||
+ | Vector3 wposition = EditorGUILayout.Vector3Field(" | ||
+ | Vector3 eulerAngles = EditorGUILayout.Vector3Field(" | ||
+ | Vector3 scale = EditorGUILayout.Vector3Field(" | ||
+ | EditorGUIUtility.LookLikeInspector(); | ||
+ | | ||
+ | if (GUI.changed) | ||
+ | { | ||
+ | Undo.RegisterUndo(t, | ||
+ | t.localPosition = FixIfNaN(position); | ||
+ | t.position = FixIfNaN(wposition); | ||
+ | t.localEulerAngles = FixIfNaN(eulerAngles); | ||
+ | t.localScale = FixIfNaN(scale); | ||
+ | } | ||
+ | } | ||
+ | else { | ||
+ | this.DrawDefaultInspector(); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | private Vector3 FixIfNaN(Vector3 v) | ||
+ | { | ||
+ | if (float.IsNaN(v.x)) | ||
+ | v.x = 0; | ||
+ | if (float.IsNaN(v.y)) | ||
+ | v.y = 0; | ||
+ | if (float.IsNaN(v.z)) | ||
+ | v.z = 0; | ||
+ | return v; | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ====== VS2010 에 shader 구문 컬러링 (Syntax Highlighting) ====== | ||
+ | |||
+ | from : [[http:// | ||
+ | |||
+ | - 폴더이동 : < | ||
+ | - ex : C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Alexandre Mutel\NShader\1.3 | ||
+ | - **NShader.pkgdef** 파일 열기 | ||
+ | - .shader 에 대한 내용 추가 < | ||
+ | 아래 구문을 찾는다, 파일 첫 부분에 있다. | ||
+ | " | ||
+ | |||
+ | 위의 구문 아래 줄에 아래 내용을 버젼에 맞게 추가. | ||
+ | <for NShader 1.2> | ||
+ | [$RootKey$\Languages\File Extensions\.shader] | ||
+ | @=" | ||
+ | <for NShader 1.3> | ||
+ | [$RootKey$\Languages\File Extensions\.shader] | ||
+ | @=" | ||
+ | </ | ||
+ | |||
+ | ===== VS2012 ===== | ||
+ | |||
+ | 확장팩 위치 : | ||
+ | |||
+ | C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\2oejd5m0.hij\NShader.pkgdef | ||
+ | |||
+ | " | ||
+ | |||
+ | < | ||
+ | |||
+ | 폴더를 검색해서 NShader.pkgdef 파일을 찾아서 수정. |