У меня 2 предупреждения. Дело не в том, что я не могу запустить игру, а в том, как мне исправить предупреждения?
Первое предупреждение:
Assets/My Scripts/Ai_Scripts/Editor/Editor.cs(56,26): предупреждение CS0618: UnityEditor.EditorGUIUtility.LookLikeControls()' устарело: Режимы LookLikeControls и LookLikeInspector устарели. Используйте EditorGUIUtility.labelWidth и EditorGUIUtility.fieldWidth для управления шириной меток и полей.'
Строка:
EditorGUIUtility.LookLikeControls();
На что мне следует изменить строку? Что означает использование EditorGUIUtility.labelWidth и EditorGUIUtility.fieldWidth? Как использовать оба?
Вторая ошибка идентична первой, только в другой части скрипта.
Предупреждение в этом методе:
//called whenever the inspector gui gets rendered
public override void OnInspectorGUI()
{
//this pulls the relative variables from unity runtime and stores them in the object
//always call this first
m_Object.Update();
//show default iMove.cs public variables in inspector
DrawDefaultInspector();
//get Path Manager component by calling method GetWaypointArray()
var path = GetPathTransform();
EditorGUILayout.Space();
//make the default styles used by EditorGUI look like controls
EditorGUIUtility.LookLikeControls();
//display custom float input field to change value of variable "sizeToAdd"
EditorGUILayout.PropertyField(m_Size);
//draw bold delay settings label
GUILayout.Label("Delay Settings:", EditorStyles.boldLabel);
//check whether a Path Manager component is set, if not display a label
if (path == null)
{
GUILayout.Label("No path set.");
//get StopAtPoint array count from serialized property and resize it to zero
//(in case of previously defined delay settings, clear old data)
m_Object.FindProperty(spArraySize).intValue = 0;
}
//path is set and boolean for displaying delay settings is true
//(button below was clicked)
else if (showDelaySetup)
{
//get StopAtPoint array reference by calling method GetStopPointArray()
var stopPoints = GetStopPointArray();
EditorGUILayout.BeginHorizontal();
//begin a scrolling view inside GUI, pass in Vector2 scroll position
scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Height(105));
//loop through waypoint array
for (int i = 0; i < path.waypoints.Length; i++)
{
GUILayout.BeginHorizontal();
//draw label with waypoint index,
//increased by one (so it does not start at zero)
GUILayout.Label((i + 1) + ".", GUILayout.Width(20));
//create a float field for every waypoint delay slot
var result = EditorGUILayout.FloatField(stopPoints, GUILayout.Width(50));
//if the float field has changed, set waypoint delay to new input
//(within serialized StopAtPoint array property)
if (GUI.changed)
SetPointDelay(i, result);
GUILayout.EndHorizontal();
}
//ends the scrollview defined above
EditorGUILayout.EndScrollView();
EditorGUILayout.BeginVertical();
//draw button for hiding of delay settings
if (GUILayout.Button("Hide Delay Settings"))
{
showDelaySetup = false;
}
//draw button to set all delay value slots to the value specified in "delayAll"
if (GUILayout.Button("Set All:"))
{
//loop through all delay slots, call SetPointDelay() and pass in "delayAll"
for (int i = 0; i < stopPoints.Length; i++)
SetPointDelay(i, delayAll);
}
//create a float field for being able to change variable delayAll
delayAll = EditorGUILayout.FloatField(delayAll, GUILayout.Width(50));
EditorGUILayout.EndVertical();
EditorGUILayout.EndHorizontal();
}
else
{
if (GUILayout.Button("Show Delay Settings"))
{
showDelaySetup = true;
}
}
m_Object.ApplyModifiedProperties();
}
Подробнее здесь: https://stackoverflow.com/questions/388 ... d-be-fixed
Как я могу исправить два предупреждения, которые я получаю в скрипте? Предупреждения надо исправить? ⇐ C#
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Как назначить различные «левые надо» некоторым ячейкам в первом столбце таблицы?
Anonymous » » в форуме Html - 0 Ответы
- 10 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Как назначить различные «левые надо» некоторым ячейкам в первом столбце таблицы?
Anonymous » » в форуме CSS - 0 Ответы
- 7 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Получаю ошибку «Ошибка незавершенного строкового литерала» в скрипте Python, почему?
Anonymous » » в форуме Python - 0 Ответы
- 7 Просмотры
-
Последнее сообщение Anonymous
-