
This is useful for creating visual variation particularly in the case of having a lot of bullets on the screen at once. You can also randomize which frame represents the initial frame, with Random Start Frame. Frame Skip will control the speed of this animation by skipping the number of frames set by this value. Next we’ll turn to the Frames field, which let’s you set up an indefinite amount of Sprite frames that the shot will iterate over in order to create a simple, looping animation. This is particularly useful if the shot type is angled rather than circular.
Unity realistic fps prefab replace visible body code#
For the rest of this guide we’ll focus simply on the Shot script’s exposed fields visible in the inspector and leave the code behind these exposed fields for the Scripting guide.Īlso for the time being, we’ll simply focus on the Shot script fields which impact the shot’s visible behavior.įirst we see the Inherit Start Rotation field which simply takes on the rotational angle of the emitter at the point of instantiation when enabled. Looking closer at the prefab, take note of its common form: An Transform, SpriteRenderer, Collider2D and an attached Shot script.

The BulletLinearNonPhysics Shot prefab is probably the most commonly used prefab, so it’s a good place to start towards understanding Shot prefabs in general. Some of these more complex Shot types will be covered in the Scripting guide. The prefabs in the Singular folder are single shot types whereas Compound are a bit more complex, using built-in events or even prefabs that themselves carry controllers/emitters. What we need to take a closer look at next is the actual Shot prefabs and, in particular, their attached shot scripts which determine their trajectory/behaviour once they’ve been instantiated.Īll default Shot prefabs are found in Assets > ND_VariaBullet > Prefabs > Shot

The previous guides have mainly focused on setting up emitters via a controller, followed by instantiating shots via the firing script attached to the emitters.
