How to convert a photo object to Texture2D in unity?

How can I get a photo object to display photos in Google Place in 2D texture in unity?

I used google maps API with infinity interface and display the rank of the place in the place name and post the photo, as a result I got a photo object as a result. Now help me find out how can I convert this photo object to displayable texture.

public class FindPlacesExample: MonoBehaviour
{
   .......
    List<OnlineMapsMarker> markers = new List<OnlineMapsMarker>();

        //int count = 0;
        foreach (OnlineMapsGooglePlacesResult result in results)
        {
            //count++;
            // Log name and location of each result.
            //Debug.Log(result.name);
            //Debug.Log(result.location);

            // Create a marker at the location of the result.
            OnlineMapsMarker marker = OnlineMaps.instance.AddMarker(result.location, result.name);

            string[] customDataArray = new string[5];
            customDataArray[0]= result.place_id;
            customDataArray[1] = result.name.Replace("amp;","");
            customDataArray[2] = result.rating.ToString();
            customDataArray[3] = result.open_now.ToString();
            customDataArray[4] = "";


            marker.customData = customDataArray;
            marker.OnClick += OnMarkerClick;
            markers.Add(marker);

}

      

As a result, I got a photo object.

+3


source to share





All Articles