1 (edited by neelg 2017-04-27 13:54:36)

Topic: How to convert OnlineMapsGoogleResult.Photo[] to NGUI UI Texture

Hello,

I am using OnlineMapsGooglePlacesResult & I want to show the place image in NGUI UI Texture object.

I am getting OnlineMapsGooglePlacesResult result.photo[], now how to add the photo[] image into NGUI UI Texture.

Re: How to convert OnlineMapsGoogleResult.Photo[] to NGUI UI Texture

Hello.

OnlineMapsGoogleResult.Photo contains only photo id (photo_reference).
To download a photo, use OnlineMapsGooglePlacesResult.Photo.Download.
http://infinity-code.com/doxygen/online … 14dd671ba3

Example:

Texture2D[] photos = new Texture2D[result.photos.Length];

for (int i = 0; i < result.photos.Length; i++)
{
    int photoIndex = i;

    result.photos[photoIndex].Download(apiKey).OnComplete += delegate (Texture2D p)
    {
        photos[photoIndex] = p;
    };
}
Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: How to convert OnlineMapsGoogleResult.Photo[] to NGUI UI Texture

Thanks for the quick response.
It works.