Sunday, 27 April 2014

Search bar scripting

With the allocation of tasks to do set out for the break, I was left to create a search bar within Unity, that is able to search various churches and display its information on the same screen. I've researched many ways of how I would approach this, finding how to do a script I can understand, and the aesthetics of it. At first, I researched a search bar that is able to function as a search bar, which was great. I would input the variables to the search bar, and it would be able to show them up when a corresponding letter or group of letters are typed.

The problem with this script (shown below) was with my limited knowledge of scripting. I wasn't able to create a box of information that would link up to the search bar, the results wasn't clickable and was not able to hide the results from the search bar. This means that as soon as I entered Play Mode in Unity, the results would instantly be right there, with nothing typed into the search bar.

After attempting to solve the problems of the previous search bar, I tried to look for another example of a search bar I could use, that is more friendlier to scripting. I then came across a drop-down sort of search bar. It suited my needs of being able to select results, and doesn't show results when in play mode. Looking at the script, I was able to change a few things around to add an individual box that would contain information and also be linked up to its corresponding search variable.

With a few minor changes around the script, I had to add the variable "ListInfo", to create a box for information to satisfy the needs the group set out.

The end result of an example of what it should look like once in game is shown below. This isn't the final design of the search bar, as minor details will be added in the future, with the option of hiding the search bar, and adding some sort of shadow or background colour to make it more visible ingame.

No comments:

Post a Comment