Search Issue Tracker
By Design
Votes
2
Found in
2018.3.0a1
2018.3.2f1
2019.1.0a1
2019.2.0a1
Issue ID
1123857
Regression
No
Assertion failed on expression: 'ShouldRunBehaviour()' error is thrown when prefab with custom script is edited
To reproduce:
1. Open user's attached project ("Prefab Editing Test")
2. Select "Test Prefab" in Hierarchy window and enter prefab mode
3. Inspect the console
Expected: No error is thrown
Actual: Error is thrown
Reproduced with: 2018.3.5f1, 2019.1.0b2, 2019.2.0a4
Comments (3)
-
unity_7slov5
Nov 21, 2022 12:58
good day everyone I got such an error when one of the sprites that I added to the scene in parallel was rejected in the graphic editing program. I hope it helps someone
-
FabDynamic
Oct 17, 2019 20:14
I have this problem as well. Applying [ExecuteInEditMode] liberally on receiving classes does seem to make it go away. The following forum thread from 2015 describes the same problem and workaround which suggests that the problem has been around since 2015.
-
btristan
Mar 14, 2019 14:47
This error also occurs when GameObject.BroadcastMessage executes a method on a class NOT marked as ExecuteInEditor while in edit mode. The method also gets executed, which should probably not happen unless the class is marked with ExecuteInEditor.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Mesh stretching and Animator values blend as if Additive when floating-point drift creates micro-overlaps between adjacent clips on the timeline
- Crash on SceneTracker::SetObjectDirty when entering Play mode on a project with specific Assets
- Constant buffers are redundantly uploaded when consecutive compute dispatches are executed on DirectX11
- UI Toolkit's TextInput element does not inherit layout parameters from the TextField element when TextField.multiline is true
- The TileMap grid in the Tile Palette is not visible when Screen Space Ambient Occlusion is enabled
Resolution Note:
This is by design:
Baker is marked with [ExecuteInEditMode] so within the editor, in edit mode it calls SendMessage("Bake") with default options (which is RequiresReceiver). As PrefabEditingTest (the behaviour with the method Bake) is not marked with [ExecuteInEditMode]/[ExecuteAlways], it does not receive the message and the assertion fails.