So, we’ve got a world which has been roughly designed and some things to look at, but what can we do inside the world? Currently? Not really much besides collect coins and kill a giant rat…not too exciting. How about we add some more to do? Like a quest? Good idea!
This time around, we are going to add in a text box, an NPC as well as show a bit more bout some box colliders and lighting. First thing, the box colliders and lighting just to get them out of the way. As you may remember when the bridge was constructed, as well as the starting buildings, the box collider was added in order to not walk through the objects.
Not sure if I mentioned it before, but there are two methods I know of to go about making the box colliders work properly and look nice. The first, which I do not use is to make a game object (cube) with box collider on. From here, you size it to the area you need and then un-click the render mesh box to hide it from view of the players. This is the easier and better method to use for beginners as it gives them more control over placement and sizing of the collider.
The second is my preferred method, adding in box colliders to the object and sizing and moving them based on dimensional values. Just to warn you, this is very tedious and consumes a lot of time to make the dimensions correct, but I feel that it helps keep things cleaner with less game objects in the long run. The choice is yours, but that’s just my preference. This is just a sample of what the dimensions look like for my walk-in building’s box colliders.
Next up, lighting. This can be done in several methods; from putting in a directional light such as the world light which we did at the start of the design process. The intensity of which controls what time of day it is, or you can put in spot lights and point lights. When adding in a light, I used another model provided by Jimmy Vegas for a lantern. Once I placed the lanterns in their respective places, I added in spotlights in the four directions of the glass on the lantern in order to give it a more realistic feel. One issue I did notice with the lights was that it would not render or show on all surfaces fully as a section would just be cut off from the light shining on it. I was not able to figure out this issue, but play around and see what you come up with if you too encounter this!
Now time for some new stuff! So, if you’re familiar with games, you know that the text boxes are vital in order to communicate with the NPC’s (Non-player characters) of the world. The first thing we need to do is bring in a canvas in which to display the text; go to the Game Objects menu and scroll down to UI option and down to Panel. I included an image to show where to go if you’re not sure what I mean.
What this will do is create a giant box in the sky which will have a canvas, panel, text, and Event System popping up in your game objects window. For now, ignore the Event Systems item and focus on Panel, Canvas and Text.
To start, we are going to need to display the panel, as this is the background on which the text will display. To do this, click on the Panel object to open it’s options. On the right side, you should now be able to position, size and color your text background. The color can be set to anything you want, just make sure you also adjust the black/white bar to give it transparency or opacity to your liking as well. Next, we can select the Box with a circle in the center just below the option menus:
This will allow you to drag and adjust the panel to the location you choose. I decided on a bottom location with a transparent purple color. This is up to you, design it to your liking or your game design. The same can be done with the text, and if you want to center it in the panel, drag the object onto the panel and zero out its location to make it in the center. From here, I used the location dragging tools to make it down and center as well as expanded the text box to fit the panel not quite fully, but more evenly. From here, I duplicated this work and drug a second box up to the top right to make a Quest Tracker Log which can be seen in the Featured Image of this article.
Also, one more note, since we don’t, or at least I don’t, want the text box visible constantly, I just un-clicked the box at the top to make it invisible during play. Next time, I’ll add in a pre-made NPC and give them some dialogue to direct the player on a simple quest! I know I said I’d add some of this now, but the post has been long enough in my option and you should play with these options before moving on. Thanks!