O'Reilly logo

Learning C# by Developing Games with Unity 3D Beginner's Guide by Terry Norton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – creating the EnergyPulse prefab

We need to create a prefab of our EnergyPulse projectile. Use the following screenshot of the Inspector as a guide for these steps.

  1. Create a new prefab by navigating to Assets | Create | Prefab and name it EnergyPulse.
  2. Add a Sphere to the Scene.
  3. Position its Transform to 0, 0, 0.
  4. Scale its Transform to 0.5, 0.5, 0.5.
  5. On the Sphere Collider, check Is Trigger.
  6. Uncheck Mesh Renderer.
  7. Add a Rigidbody Component.
  8. Turn off Gravity.
  9. Add the script EnergyPulsePower (see Appendix B).
  10. Add a Trail Renderer Component by navigating toComponent | Effects | Trail Renderer.
  11. Drag a GoodOrb prefab to the Good Orb property on the Energy Pulse Power (Script).
  12. Set the Trail Renderer properties as shown in the following screenshot. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required