Skip to content
James Liu edited this page Apr 24, 2015 · 2 revisions

In DanmakU, bullets are defined using Danmaku Prefabs. While DanmakuPrefabs are attached as behaviors to a GameObject, they are assets, and thus not intended to be used directly or through standard Unity prefab instantiation. Rather they're simply container objects that contain data about a bullet, created as a Prefab/GameObject for easy in-editor editing.

DanmakuPrefab is a sealed class, you cannot derive new Prefab types from it.

A DanmakuPrefab has 4 components:

  • The DanmakuPrefab script itself.
  • This denotes the GameObject as a DanmakuPrefab.
  • It has optional fields for DanmakuControllers, which can used to pre-define behavior of bullets made from this prefab.
  • A 2D Collider. (For now, only Circle Colliders are supported)
  • This defines the collision behavior of the bullet. AKA the bullet's hitbox.
  • A Renderer: Either a Sprite Renderer or a Mesh Renderer.
  • This defines the look and feel of the bullet.
  • All bullets created from this prefab will share the same Mesh or Sprite, size, and material used by this renderer.
  • A Transform:
  • Only the scale is used here as a reference to stretch/scale the mesh/sprite as needed when creating bullets from the prefab.
Clone this wiki locally