Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CommandBindings fail to bind on ItemTemplate prefabs #8

Open
ritijain opened this issue Jun 10, 2019 · 0 comments
Open

CommandBindings fail to bind on ItemTemplate prefabs #8

ritijain opened this issue Jun 10, 2019 · 0 comments

Comments

@ritijain
Copy link
Contributor

Repro Steps

  1. Use an ItemsControl script to spawn a collection of prefabs (make sure the itemtemplate prefab has a commandbinding on it eg - a grid layout of clickable buttons)
  2. Try using it in the UnityEditor - it works fine and the spawned buttons from itemscontrol are clickable and execute the CommandBinding as expected
  3. Try deploying the same to a UWP - the spawned prefabs lose their CommandBinding.

Root Cause
On deeper investigation, it turns out that the gameobject that gets created for the item template prefab is missing the "ExecuteCommand" handler for its click event. This happens because when item template instantuiates gameobjects in editor, it also runs the corresponding "FigureViewBinding" method. However since that method exists in the Editor script, the event handler is never added to the game objects that get created in the UWP.

This is also the case for nested prefabs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant