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
- Shader Graph does not get saved when pressing 'File -> Save'
- MultiColumnListView does not visually sort the column when BindingSourceSelection is set to "Auto Assign"
- GameObject assigned to Target Graphic in uGUI Toggle component stays dimmed when replacing it if Interactable was toggled off
- "GraphicsBuffer.IsValid()" returns incorrect result when SkinnedMeshRenderer is disabled
- Clear Dynamic Data On Build does not clear data after a clean build when the Atlas Population Mode is set to "Dynamic" or "Dynamic OS"
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.