March 2018
Beginner
336 pages
8h 6m
English
Earlier in this chapter, we created a BeetleNPC script file and attached it to our Beetle prefab. That script detected collisions with the Cucumber Man. In this section, we will modify that script so that it can also detect when it collides with a cucumber.
Let's first ensure that the cucumbers are properly set up. Check that the is selected (checked) in the cucumber's Box Collider component in the Inspector panel. Next, make several copies of your cucumber throughout the sandbox area of your scene. You can place them in close proximity to your beetles for easier testing. See the following screenshot for an optimal test configuration:
The BeetleNPC script needs a new variable and two methods, one of which will ...
Read now
Unlock full access