UnityMvvmToolkit icon indicating copy to clipboard operation
UnityMvvmToolkit copied to clipboard

Clear error message when no bindable elements found.

Open stilnat opened this issue 1 year ago • 0 comments

Feature request

When creating a new view prefab, I made the mistake to put bindable elements on the root game object, and could not get anything to work. While going through the code I ended up seeing that bindable elements should be on child game objects only.

_bindableElements = RootElement
    .GetComponentsInChildren<IBindableElement>(true)
    .Where(element => ((MonoBehaviour) element).gameObject != RootElement)
    .ToList();

I suggest adding a debug message when the _bindableElements list has 0 elements such as : "No bindable elements found, did you add bindable elements on children gameobjects of the Canvas view's Game object ?" Or something similar.

stilnat avatar Dec 02 '24 12:12 stilnat