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. ...

Get Learning C# by Developing Games with Unity 3D Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.