Unity Error: !IsPlayingOrEditMode ?

Hi,

what might be the reason Unity 2.0.2 gives an error to the console: !IsPlayingOrEditMode? The full error is:

!IsPlayingOrEditMode ()
UnityEngine.SendMouseEvents:smile:oSendMouseEvents()

[/Users/unity-build/Desktop/automatic-build-2/unity/Projects/…/Runtime/Mono/MonoBehaviour.cpp line 721]

After this error something funny may happen: like editing object positions may not work in the sense that the objects may be returned to their positions before this error, however things feel pretty random to me.

Please note, I’m NOT trying to do editor scripting or something like that in my project.

Thanks,
-JR

I get the same error. Possibly since v. 2.0.2.

~ce

Yep. I’ve been getting the same error pretty consistently now. Again, I’m not doing any editor scripting. Anyone know what might cause this?

I’ve been getting it too. At first I thought it was the scripts in my Editor folder, but I deleted all of them and it still happens.

Doesn’t seem to do anything bad, but I’m sure we all hate seeing that red X!

Any news for this subject? Has anyone managed to track the reason for this error?

I am getting the same error message and also experience the problem that newly linked prefabs dragged to variables exposed in the inspector frequently are forgetten and they need to be linked a second time. This is happening in Unity v2.0.2

Wow. Plenty of people with this error. How about reproducing the error in a simplified project and sending that via the bug reporter? One from each if possible to determine if the cause is the same.

I am actually getting this error a lot and having positions of objects changed around in the editor without my touching them when this warning comes up…

If the behavior is consistent, please choose Help->Report a Problem, then give us a description of when/where the message is occurring and attach your project folder. We’ll try to reproduce the issue.

I submitted this bug some time ago (#18418), but it was marked as closed. It still happens and is 100% reproducible, though, so I encourage others to submit this too, so hopefully they can get to the bottom of it. :slight_smile:

–Eric

One place I have consistently noticed this bug when I have scripts with OnMouseEnter (and its kin) in the open scene. It seems that Unity will sometimes execute the function while the game is not playing. Since this happens in edit mode, it can affect assets and scene information. One workaround is to add

if (!Application.isPlaying)
	return;

to the top of your OnMouseEnter functions. I haven’t tested to see if this is still a problem in 2.1.

Yeah, that’s basically what I ended up doing (although the error message still appears). And yep, it’s still a problem in 2.1.

–Eric

Thanks for the tip, this was driving me crazy! :slight_smile:

sorry to bump an old thread,
but lately i’m getting a lot of this warning, hopefully
this doesn’t break the game :stuck_out_tongue:

Is this something serious though ??

110830--4248--$warning_440.jpg

Nah, I get it all the time too, I regard it as a bug in Unity somewhat. :frowning:

Thank you so much, I just started having this problem today and right at the end of a project too. I changed a few buttons so that they would change color when you moused over them. So I was using OnMouseEnter and OnMouseExit.

In the editor if I tried to drag a Material on to them it would call those functions and they would permanently change to that color. It also happened when I was switching back to Unity from Unitron.

Adding your code to those functions fixed my problem though. I hope this problem is addressed in 2.5, I could see it causing huge problems to certain games.

still have it in 2.6

now i got this and it is really annoying. It floods the console with the error:

The version is 2.6.1f3

:frowning:

Bumping. I’m also getting this error and don’t know what’s causing it =/

!IsPlayingOrEditMode ()
UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
UnityEngine.MouseOverPair:SendMessage(String)
UnityEngine.SendMouseEvents:smile:oSendMouseEvents()

[…..\Runtime\Mono\MonoBehaviour.cpp line 806]

I thought it was related to a Send Message from a mouse over event, but even after disabling everything that did that I still got this issue.

Is this with an editor script? Are you actually calling SendMessage yourself anywhere?