'전체보기'에 해당되는 글 1150건
- 2021.12.25 유니티 페이스북 인증 2021
- 2021.12.24 과금 정책 자료
- 2021.12.18 유니티 조인트
- 2021.12.17 전자부품 자료 모음
- 2021.12.16 유니티 프로퍼티 드로워
- 2021.12.16 유니티 ScriptableObject
- 2021.12.14 자주 쓰는 유니티 포톤챗 코드
- 2021.12.13 디버그로그 음소거
CharacterJoint
-Axis 0,1,0 기준
LowTwistLimit : pitchLimitLow
HighTwistLimit : pitchLimitHigh
Swing1Limit : yawLimit
Swing2Limit: rollLimit
'Unity' 카테고리의 다른 글
유니티 페이스북 인증 2021 (0) | 2021.12.25 |
---|---|
유니티 프로퍼티 드로워 (0) | 2021.12.16 |
디버그로그 음소거 (0) | 2021.12.13 |
하네스 와이어
개당 8원 (2021)
USB 트리거
QC 급속충전을 이용하여 12v출력이 가능
'공학기술' 카테고리의 다른 글
ClearType 초기화 (0) | 2022.04.14 |
---|---|
구글 크롬 원격 데스크톱 사용법 (0) | 2021.09.17 |
자주 쓰는 엑셀 기능 모음 (0) | 2021.04.15 |
https://docs.unity3d.com/kr/2021.3/Manual/editor-PropertyDrawers.html
프로퍼티 드로어 - Unity 매뉴얼
프로퍼티 드로어는 스크립트에서 속성을 사용하거나 특정 Serializable 클래스가 표시되어야 하는 방법을 제어하여 인스펙터(Inspector) 창 에 특정 컨트롤이 표시되는 방법을 커스터마이즈할 때 사
docs.unity3d.com
공식 매뉴얼
비슷한것으론 DecoratorDrawer가 있다
[ReadOnly] 로 사용
이건 내가 만든게 아니다
원문링크 : https://discussions.unity.com/t/how-to-make-a-readonly-property-in-inspector/75448
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
[CustomPropertyDrawer(typeof(ReadOnlyAttribute))]
public class ReadOnlyDrawer : PropertyDrawer
{
public override float GetPropertyHeight(SerializedProperty property,GUIContent label)
{
return EditorGUI.GetPropertyHeight(property, label, true);
}
public override void OnGUI(Rect position,SerializedProperty property,GUIContent label)
{
GUI.enabled = false;
{
EditorGUI.PropertyField(position, property, label, true);
}
GUI.enabled = true;
}
}
#endif
public class ReadOnlyAttribute : PropertyAttribute
{
}
이걸로 다중배열은 안 되니 뻘짓하지 말자
왜냐면 배열은 프로퍼티드로워는 OnGUI에서 하위 항목만 접근 가능하고
다중배열은 접근불가하게 원천으로 차단해버린다
그리고 이걸로 버튼 어트리뷰트 만들어볼려고 했는데 필드에만 선언이 되어서
ContextMenu로 대체했다
자세한건 어트리뷰트 참고
유니티 어트리뷰트
인스펙터계열 어트리뷰트 //해당 변수가 어떤 역할인지 위에 굵은 글씨로 표시해줌 [Header("헤더이름")] //슬라이더로 표시해줌 [Range(0.5f,1.5f)] //슬라이더바가 있는 멀티라인 [TextArea(1,30)] public strin
wmmu.tistory.com
그리고 툴 만들다가 드로워로 클래스별 인스펙터를 구현할 일이 있어서 만들었다
몰론 바로 폐기되었지만 언젠가 또 쓸일이 있을듯
기능제약은 심하지만 간결해서 빠르게 작성할수 있다는점이 좋다
이 코드는 https://github.com/ahzkwid/AhzkwidAvatarTools 이곳에 잠깐 사용되었다가 삭제되었다
#if UNITY_EDITOR
using UnityEditor;
using UnityEditorInternal;
[CustomPropertyDrawer(typeof(BlendshapeSettingDataAttribute))]
public class BlendshapeSettingDataDrawer : PropertyDrawer
{
public override void OnGUI(Rect rect, SerializedProperty property, GUIContent label)
{
var fieldRect = rect;
fieldRect.width /= 2;
{
var path = nameof(BlendshapeAutoSetter.BlendshapeSettingData.name);
EditorGUI.PropertyField(fieldRect, property.FindPropertyRelative(path), new GUIContent(path), true);
}
fieldRect.x += fieldRect.width;
EditorGUI.PropertyField(fieldRect, property.FindPropertyRelative(nameof(BlendshapeAutoSetter.BlendshapeSettingData.value)), label, true);
}
}
public class BlendshapeSettingDataAttribute : PropertyAttribute
{
}
#endif
public class BlendshapeAutoSetter : MonoBehaviour
{
[System.Serializable]
public class BlendshapeSettingData
{
public string name;
[Range(0,100)]
public float value = 100;
}
[System.Serializable]
public class BlendshapeTarget
{
public Mesh mesh;
[BlendshapeSettingData]
public List<BlendshapeSettingData> blendshapeValues;
//public Dictionary<string,float> keyValuePairs = new Dictionary<string,float>();
}
bool success = false;
public bool autoDestroy = true;
public List<BlendshapeTarget> blendshapeTargets = new List<BlendshapeTarget>();
}