-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
GameObjectExtensions.BindChildPrefabsTo() should destroy instantiated prefabs during element removal from ReactiveCollection.
But GameObjectExtensions.onElementRemoved() destorys transform of instantiated prefab instead of gameobject.
This is not working if instance has RectTransfom.
There are 2 cases:
- RectTransfom destoryed and replaced with Transform.
- RectTransform not destroyed because there is another component depending on it.
In both cases actual gameobject not destroyed.
I suggest replcaing impelmentation of GameObjectExtensions.onElementRemoved() to:
void onElementRemoved(CollectionRemoveEvent<T> data)
{
var existingChild = input.transform.GetChild(data.Index).gameObject;
onChildRemoving?.Invoke(data.Value, existingChild);
GameObject.Destroy(existingChild);
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels