Unity-Weld icon indicating copy to clipboard operation
Unity-Weld copied to clipboard

Image Binder

Open Avatarchik opened this issue 7 years ago • 2 comments

Hello! Thanks for the project, is there a possibility of binding a picture or for the next it is necessary to write your adapter? Is there still an option to make a list with a pool of objects so as not to load everything into the UI and load it like that?

Avatarchik avatar Feb 21 '18 11:02 Avatarchik

In the past I've done this by exposing a property of type Texture on my view model and binding to it directly.

I like the idea of being able to have an adapter that takes something like a string and loads a texture from resources based on the string identifier though. Adapters are quite simple to write if you want to try this yourself. Have a look at the existing ones in UnityWeld/Binding/Adapters/ for some examples.

Resource pooling is a good idea but you would need to implement your own class for managing that. Managing pools of objects is probably outside the scope of this library.

RoryDungan avatar Feb 22 '18 05:02 RoryDungan

Sorry I should have specified, when I did this I used a RawImage component and a one way property binding to bind its texture property to a property on my view model.

image

If you wanted to use an adapter you would have to create something like a StringToTexture2DAdapter that calls Resources.Load in its Convert function.

RoryDungan avatar Feb 22 '18 05:02 RoryDungan