Importing the RampColliders

If you have ever worked with Unity in a team setting, especially in a source control environment such as GitHub or BitBucket, you may have run into issues like overwriting each other's work. It can be hard to avoid this situation at times. Prefabs are one of the safeguards against killing each other's work.

In this section, we will import a Prefab and put it inside our main Prefab. This allows us to update part of a Prefab with little hassle. Once it's in, it should align perfectly and be ready to go.

The RampColliders object was made as a result of a physics error that was happening with the project. In response to the error, I turned off the mesh collider on the ramp object and created five objects layered in a way that attempts to mimic the curve of the ramp, as pictured earlier in this chapter.

If you have all the associated project files downloaded, locate them. If not, you should download them now and have them ready. Follow the given steps:

  1. Click on the Assets button in the main menu:
  1. Click on the ImportPackage option:
  1. Click on Custom Package.... When the open file window appears, navigate to the location you have the downloads for this book. Then, select rampcolliders.unitypackage:
  1. When the Import Unity Package window appears, ensure that the RampCollider.prefab is the only thing with a check mark next to it and click on the Import button:
  1. Now if you go to your Project view and look in the Prefabs directory, there should be a new object called RampCollider:
  1. Click on the RampCollider object, drag it to the skee Hierarchy, and drop it. Ensure that it is a child of skee, not a grandchild:
  1. If you have done everything correctly and you click on the RampCollider parent object, you should see a (green) wireframe similar to the one in the picture:
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.125.219