ArgumentException: Getting control 3's position in a group with only 3 controls when doing repaint
Aborting
UnityEngine.GUILayoutGroup.GetNext () (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/LayoutGroup.cs:129)
UnityEngine.GUILayoutUtility.DoGetRect (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUILayoutUtility.cs:450)
UnityEngine.GUILayoutUtility.GetRect (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUILayoutUtility.cs:407)
UnityEngine.GUILayout.DoButton (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUILayout.cs:36)
UnityEngine.GUILayout.Button (System.String text, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUILayout.cs:32)
DG.DOTweenEditor.DOTweenAnimationInspector.OnInspectorGUI () (at Assets/Plugins/Demigiant/DOTweenPro/Editor/DOTweenAnimationInspector.cs:223)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.<CreateIMGUIInspectorFromEditor>b__0 () (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Editor/Inspector/InspectorElement.cs:636)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)
dotween pro 에 animation component를 사용하다보면 이런 에러를 마주할때가 있다.

이런 오류를 만날때 도트윈 자체에 에러기도 하고 수정해주지않아 한번 dotween을 커스텀해서 사용해보자 !!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using DG.DOTweenEditor;
using DG.Tweening;
[CustomEditor(typeof(DotweenComponent))]
public class DOTweenCustomInspector : Editor
{
DotweenComponent targetComponent;
private void OnDisable()
{
if (targetComponent == null) { return; }
DOTweenEditorPreview.Stop(true);
}
public void SetAnimation_Play()
{
if (targetComponent == null) { return; }
DOTweenEditorPreview.Stop(true);
targetComponent.InitSequence();
var seq = targetComponent.GetSequence();
DOTweenEditorPreview.PrepareTweenForPreview(seq);
DOTweenEditorPreview.Start(() => {
EditorUtility.SetDirty(targetComponent.gameObject);
});
if (seq != null) { seq.Play(); }
}
public void SetAnimation_Pause()
{
if (targetComponent == null) { return; }
// var seq = targetComponent.GetSequence();
// if (seq != null){ seq.Pause(); }
}
public void SetAnimation_Stop()
{
if (targetComponent == null) { return; }
var seq = targetComponent.GetSequence();
DOTweenEditorPreview.Stop(true);
EditorUtility.SetDirty(targetComponent.gameObject);
}
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
targetComponent = (DotweenComponent)target;
EditorGUILayout.Space();
EditorGUILayout.Space();
var styleText = new GUIStyle(GUI.skin.label);
styleText.normal.textColor = Color.green;
EditorGUILayout.LabelField("EDITOR ONLY", styleText);
var style = new GUIStyle(GUI.skin.button);
EditorGUILayout.BeginHorizontal();
style.fixedHeight = 40;
style.fixedWidth = 80;
if (GUILayout.Button(new GUIContent(EditorGUIUtility.IconContent("PlayButton On").image), style)) { SetAnimation_Play(); }
// if(GUILayout.Button(new GUIContent(EditorGUIUtility.IconContent("PauseButton On").image), style)) { SetAnimation_Pause(); }
if (GUILayout.Button(new GUIContent(EditorGUIUtility.IconContent("animationdopesheetkeyframe").image), style)) { SetAnimation_Stop(); }
EditorGUILayout.EndHorizontal();
}
}
DOTweenEditorPreview 를 통하여 수정과 제작을 할 수 있다.
'Unity' 카테고리의 다른 글
[Unity] Spine Component가 에디터 밖에 들어갔다오면 기본값으로 수정되는 현상 (0) | 2023.08.05 |
---|---|
UniTask 란? (0) | 2023.08.01 |
[Unity] FlatBuffer 최신화 하기 (0) | 2023.07.29 |
FireBase Sdk 10.2 업데이트때 발생하는 문제 (0) | 2023.07.27 |
프로그래머를 위한 워크플로 속도 향상 팁 (0) | 2023.07.26 |