How to do it...

To create an editor extension to allow pickup type (and parameters) to be changed at Design Time via a custom Inspector UI, follow these steps:

  1. Start with a new copy of mini-game Simple2Dgame_SpaceGirl.
  2. In the Project panel, create a new folder named EditorSprites. Move the following images from folder Sprites into this new folder: star, healthheart, icon_key_green_100, icon_key_green_32, icon_star_32, and icon_heart_32:
  1. In the Hierarchy panel, rename GameObject star to be named pickup.
  2. Edit the tags, changing tag Star to Pickup. Ensure the pickup GameObject now has the tag Pickup.
  3. Create C# script-class PickUp and add an ...

Get Unity 2018 Cookbook - Third Edition 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.