unity3d - UI prefabs: buttons does not retain onclick() settings -


i have simple prefab, made prefab button , panel. button placed inside panel child of panel. did save prefab , good.

then, did add click event on button; did add gameobject script want use placed, , select correct method use. did update prefab , deleted scene.

now, when instantiate prefab in scene resources.load("myuiprefab"); show correctly panel, button , colors/settings.

but there nothing connected click button itself; result in button doing nothing.

isnt' prefab, way save object used @ later time? in case should retain click settings. bug or unfortunate implementation of new unity ui system? makes little sense make prefab out of button or gui element, if click() or other delegate not filled.

gameobjects stored in prefab can hold references other objects inside same prefab, or other prefabs. true object references, events, whatever.

if want event persist, must have event handler in same prefab , have called button. can simple handler method raises standard .net event when called (.net events may easier use unity events).


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -