From the course: Unity: Integrating GPS and Points of Interest
Unlock this course with a free trial
Join today to access over 22,600 courses taught by industry experts.
Sort results by nearest first, part 2 - Unity Tutorial
From the course: Unity: Integrating GPS and Points of Interest
Sort results by nearest first, part 2
- So the trick is to make this as flexible as possible. Now, you might be wondering why I didn't just put this in right at the beginning and order it by nearest first. Well, maybe you don't want to do that. Maybe you just want to have everything listed and then allow the user to decide. So, by doing it this way, it's kind of giving you the flexibility. Okay, now, what are we going to need next? Well, if we come down here, we're going to need a public void. Well, it doesn't have to be public, even, it can just be a normal void. And this particular one will be called RePopulate. Okay, there we go. Now, RePopulate, this is going to take in a list of items which is the items list, that's passed in. But I'm going to rename this one as itemsPassed, just to make it easier to differentiate. So, what this function will do, then, is it will be passed an organized list of items, depending on what you've decided on, whether that be to order by the title or the distance or any additional variables…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Creating a Google Cloud live account9m 31s
-
(Locked)
App layout and scrolling menu buttons9m 22s
-
(Locked)
Project setup7m 18s
-
Create a scene controller13m 34s
-
(Locked)
Connect the GPS class to the place finder app11m 14s
-
(Locked)
Load data from a website URL, part 1 from inside Unity8m 43s
-
(Locked)
Load data from a website URL from inside Unity, part 29m 48s
-
(Locked)
Refactor code to improve functionality3m 56s
-
(Locked)
Process the JSON code from a URL11m 23s
-
(Locked)
Populate a virtual object with JSON data16m 1s
-
(Locked)
Use the real names on prefabs3m 31s
-
(Locked)
Calculate distance using GPS14m 27s
-
(Locked)
Dynamic button listeners, part 14m 16s
-
(Locked)
Dynamic button listeners, part 211m 54s
-
(Locked)
Sort results by nearest first, part 110m 12s
-
(Locked)
Sort results by nearest first, part 28m 43s
-
(Locked)
Sort results by nearest first, part 39m 56s
-
(Locked)
-