Perhaps one of the most challenging features to implement within my Unity-based interactive experience was the custom search feature. In this blog, I shall document the timely development process I endured to achieve this functionality.
When initially developing my early prototype, I had developed a primitive form of search functionality that simply gathered the user’s input and attempted to match this input to the “GameObject” building names within the Unity scene.
This form of search is extremely primitive as the user is required to enter the exact name of a game object building in order to return any form of result. After presenting my early prototype, I then went about developing a more advanced search feature that could make use of concepts such as tags or keywords.
Motion and Interaction
Whilst the search feature may appear a simple piece of user interaction and interface design, I spent much time developing smooth search state animations within Unity’s inbuilt animation manager. This enabled me to maintain screen space for the user by incorporating an expansion motion for the input area. Moreover, I also integrated audio response in order to confirm user interactions such as pressing the enter key to submit a search query.
Before implementing any form of further advanced search functionality, I decided to undertake research across the Unity developer community in order to gather concepts from which I could base development.
Unfortunately, advanced search is not a common feature among Unity projects, therefore leaving me with a lack of inspiration from which I could base my development.
However, using my previous experience in web development. I decided to pursue the concept of a keyword-based search feature. This is essentially based on the concept of storing a string list of keywords for each returnable search object (London landmark models) and matching these keywords to that of the user’s search input.
Moreover, I also introduced error handling functionality that either notified the user when their search returned no clear result or encouraged the user to enter a query if the input field is blank.
In addition, I developed another essential function that reset the user search input by setting the input string empty. Therefore preparing the search box for another search entry.
The screenshot below displays the essential source code from which the search functionality is based.
In addition, as previously mentioned I created keyword string lists from which the user’s search would be compared to. The screenshot below shows some of the keyword list strings.
Given the restricted development time in the remainder of this project, I am happy to have accomplished a search feature of this complexity. However, if I had to further improve the search I would look to implement a suggested search, drop down list and active spelling correction.