Search Issue Tracker
Duplicate
Votes
1
Found in
5.2.0p1
Issue ID
728950
Regression
Yes
Upgrading project from 5.0 breaks Event Triggers
How to repro from scratch:
- in Unity 5.0:
- create scene, delete everything add a game object
- add an event trigger
- add a event type (ie "Pointer Down")
- add a handler (ie <TheGameObject>.transform.sendMessage("aaa"))
- create a prefab from this object
- on the scene instance, add a second handler (ie <TheGameObject>.transform.sendMessage("bbb")), displayed in bold as it's a prefab override
- force text serialization in editor settings
- save the scene (ie "scene.unity")
- in Unity 5.3:
- open the project
- notice only the first handler is present ("aaa")
- close the project
- open the scene file in a text editor
- notice how the new handler tries to modify the "delegates" property of the trigger instead of the new "m_Delegates"
- replace "delegates" by "m_Delegates"
- reopen the project+scene
- the second handler is now present
note:
the prefab itself still references "delegates" instead of "m_Delegates", but that works. In EventTrigger.cs, this is present:
[FormerlySerializedAs("delegates")]
[SerializeField]
private List<Entry> m_Delegates;
[Obsolete("Please use triggers instead (UnityUpgradable) -> triggers",true)]
public List<Entry> delegates;
so it looks like the "FormerlySerializedAs" is misused when deserializing prefab instances.
Original repro:
1. Open the attached project in Unity 5.0
2. Open and play Scene1 scene
3. Click buttons "Issues 1" >"Choise 2"> "Issue 2" >"Arrow"
4. Notice that it all works
5. Open Project with newer Unity version 5.1, 5.2, 5.3
6. repeat 2 and 3 steps
7. Notice that "Choice2" and "Arrow" doesn't work
Note:
-"Choice2" button: Event method is still in "HorizontalLayout2Buttons">"MenuColumn2Buttons">"Button2"as it was created in prefab. If you delete it and recreate the same EventTrigger, it will work (Scene2)
-"Arrow" button: Another event method which was created in the scene view and not applied to a prefab "MenuNextPage" doesn't exist in scene view, it has to be created again (Scene3)
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
- [URP][Tutorial] Universal 3D Sample tutorial issues
- Gradle error: "...Unexpected error during link..." is thrown when building for Android and targeting API Level 34
- Crash on ReplaceTextureData when rapidly changing light intensity
- Uneven lighting is seen on the GameObjects when Sky Occlusion is enabled
- Editor freezes and a "Failed to present D3D11 swapchain" error appears when toggling loop time option and entering Play Mode
This is a duplicate of issue #732717