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.
- Create a new prefab by navigating to Assets | Create | Prefab and name it
EnergyPulse
. - Add a Sphere to the Scene.
- Position its Transform to
0
,0
,0
. - Scale its Transform to
0.5
,0.5
,0.5
. - On the Sphere Collider, check Is Trigger.
- Uncheck Mesh Renderer.
- Add a Rigidbody Component.
- Turn off Gravity.
- Add the script
EnergyPulsePower
(see Appendix B). - Add a Trail Renderer Component by navigating toComponent | Effects | Trail Renderer.
- Drag a GoodOrb prefab to the Good Orb property on the Energy Pulse Power (Script).
- 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.