I have just jumped to Unity and I am doing some experiments to retrive data from an API
Below you can see the test code could you please help me to understand if i am the right way or not please?, because probably i am missing the mapper isn't it ?
Thanks in advance.
void Start()
{
comments= StartCoroutine(this.GetComments("https://jsonplaceholder.typicode.com/comments"));
Debug.Log(comments);
}
private IEnumerator Comments GetComments(string url) {
List<Comments> returnComments = new List<Comments>();
UnityWebRequest comments = UnityWebRequest.Get(url)
comments.SendWebRequest();
while (comments.MoveNext())
{
var comment = comments.Current;
returnItems.Add(comment);
}
return returnComments;
}