Skip to main content
added 9 characters in body
Source Link
liggiorgio
  • 4.9k
  • 6
  • 26
  • 37

Stacked with excatlyexactly the same problem.

What this code does is change the label above objects(in my case players) head. Inside OnInspectorGUI:

EditorGUI.BeginChangeCheck();

int currentScore = EditorGUILayout.IntField(...)

if (EditorGUI.EndChangeCheck())
{
    (sp.objectReferenceValue as Object).ChangeLabelAboveObject(currentScore);
    EditorApplication.QueuePlayerLoopUpdate();
    GUI.FocusControl(null);
}

Explanation: sp - SerializedProperty, Object - any MonoBehaviour you like.

But the main: everything goes ok when I added EditorApplication.QueuePlayerLoopUpdate Hope.

Hope this will help some1someone, because I was looking for this for hours.

Stacked with excatly the same problem.

What this code does is change label above objects(in my case players) head. Inside OnInspectorGUI:

EditorGUI.BeginChangeCheck();

int currentScore = EditorGUILayout.IntField(...)

if (EditorGUI.EndChangeCheck())
{
    (sp.objectReferenceValue as Object).ChangeLabelAboveObject(currentScore);
    EditorApplication.QueuePlayerLoopUpdate();
    GUI.FocusControl(null);
}

Explanation: sp - SerializedProperty, Object - any MonoBehaviour you like.

But the main: everything goes ok when I added EditorApplication.QueuePlayerLoopUpdate Hope this will help some1, because I was looking for this for hours.

Stacked with exactly the same problem.

What this code does is change the label above objects(in my case players) head. Inside OnInspectorGUI:

EditorGUI.BeginChangeCheck();

int currentScore = EditorGUILayout.IntField(...)

if (EditorGUI.EndChangeCheck())
{
    (sp.objectReferenceValue as Object).ChangeLabelAboveObject(currentScore);
    EditorApplication.QueuePlayerLoopUpdate();
    GUI.FocusControl(null);
}

Explanation: sp - SerializedProperty, Object - any MonoBehaviour you like.

But the main: everything goes ok when I added EditorApplication.QueuePlayerLoopUpdate.

Hope this will help someone, because I was looking for this for hours.

Source Link

Stacked with excatly the same problem.

What this code does is change label above objects(in my case players) head. Inside OnInspectorGUI:

EditorGUI.BeginChangeCheck();

int currentScore = EditorGUILayout.IntField(...)

if (EditorGUI.EndChangeCheck())
{
    (sp.objectReferenceValue as Object).ChangeLabelAboveObject(currentScore);
    EditorApplication.QueuePlayerLoopUpdate();
    GUI.FocusControl(null);
}

Explanation: sp - SerializedProperty, Object - any MonoBehaviour you like.

But the main: everything goes ok when I added EditorApplication.QueuePlayerLoopUpdate Hope this will help some1, because I was looking for this for hours.