An editor extension to allow pickup type (and parameters) to be changed at design time via a custom Inspector UI

The use of enums and corresponding drop-down menus in the Inspector panel to restrict changes to one of a limited set often works fine (for example, pickup types for a pickup object). However, the trouble with this approach is, when two or more properties are related and need to be changed together, there is a danger of changing one property, for example, pickup type from Heart to Key, but forgetting to change corresponding properties; for example, leaving the Sprite Renderer component still showing a Heart sprite. Such mismatches cause problems both in terms of messing up intended level design and, of course, the frustration for the ...

Get Unity 5.x Cookbook 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.