Anyone know what this is?

The targets array should not be used inside OnSceneGUI or OnPreviewGUI. Use the single target property instead.
UnityEditor.GameObjectInspector:OnEnable()

The serializedObject should not be used inside OnSceneGUI or OnPreviewGUI. Use the target property directly instead.
UnityEditor.TransformInspector:OnEnable()

When i stop the project i get about 20 of those errors.
I have never seen errors that happen after I stop the project so i have no idea what’s happening.

The cause is the functions below

function cleanhead(){	
				var objects = GameObject.FindGameObjectsWithTag("head");
				for (var i : int=0; i<objects.length; i++){
   				 Destroy(objects[i]);			
			}
}

function CharacterCreation(){
	
	if(changepart == true){	
	
	if(headid == 0){
		cleanhead();
		var head0 : GameObject = Resources.Load("head0") as GameObject;
		Instantiate (head0, headhotspot.transform.position, headhotspot.transform.rotation);
		changepart = false;
		}
		
		
		
		

	if(headid == 1){
		cleanhead();
		var head1 : GameObject = Resources.Load("head1") as GameObject;
		Instantiate (head1, headhotspot.transform.position, headhotspot.transform.rotation);
		changepart = false;
	}
	
	}
	
	
}

http://forum.unity3d.com/threads/143875-Using-code-tags-properly

Thank you.

Well i fixed it by

	var objects = GameObject.FindGameObjectWithTag("head");
				
   				Destroy(objects);

To anyone having the same error message (and coming here from google):

Make sure your OnSceneGUI method is not marked as virtual or overwritten by subclasses. This seems to confuse Unity. Put your logic into a separate function and implement a new OnSceneGUI handler per subclass that calls that method.

6 Likes

@spaceemotion I’ve reported this as a bug, with a reproduction case - it really shouldn’t be happening - and added your observation about “virtual” to the bug report.

I never saw this before Unity 2019.x, so I’m wondering if it was introduced then?

To add to @spaceemotion 's observations, CanEditMultipleObjects will also cause the error. I’m seeing this still in 2022.3.4f1.