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
-
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
- [Dragon Crashers] Build fails in U6
- [Dragon Crashers] 4 Shader error messages on import
- [Dragon Crashers] Readme text is white on light grey
- Cursor stays in front of the first character when entering text in the TextMeshPro field
- Searching in Hierarchy causes unwanted component calls
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.