From the course: Unity: Integrating GPS and Points of Interest

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

Refactor code to improve functionality

Refactor code to improve functionality - Unity Tutorial

From the course: Unity: Integrating GPS and Points of Interest

Refactor code to improve functionality

- Okay guys, welcome back. Now, this video's a little bit different because what I've actually done is I've jumped back through in the course slightly to refactor this code a little bit to make it a little bit better. Refactor basically means rejig or move around if you are unfamiliar with the term. Now what we've just done, if I just open up the scene controller for a second, here we go, we are setting the ask Google command on click of the button, and we're overwriting the keyword and calling the request. Then what the existing video would have told you to do would be to create another variable and pass this text element, this string, through to the following script. But there's a better way of doing things. So what we're going to do is, inside Unity, let's just create inside the scripts folder which is inside pack. I'm just going to create a new C sharp script which we would have done anyway for the list view. Okay, now let's open up the list bar. In fact, let's switch scenes…

Contents