Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

[RELEASED] BulletPro - 2D Projectile Workspace

Discussion in 'Assets and Asset Store' started by AlbinosMou, Oct 18, 2020.

  1. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    23



    Greetings, I’m here to present BulletPro, which will be your most practical solution to set up any projectile configuration for any 2D gameplay!

    BulletPro stands out by its instantaneous ease of use for every game genre that would require hitbox management: tower defense, platforming, top-down action games, and of course the most complex bullet hell patterns.


    This plugin is compatible with any version of Unity from 2018.4 to 2020.1, and comes with the following arguments:

    1 - Maximized ease of use:
    • BulletPro can create any 2D gameplay that involves projectiles, without a single line of code, in the most comfortable workspace: see images below.
    • But for experienced developers who prefer to use code, there are also scriptable bullet behaviours, and an Online Script Reference to this API - BulletPro can easily be extended.

    • WYSIWYG bullet layout editor: stack layout modifiers, draw stuff, work from textures, and so much more

    • Multiple alternative workflows:
    • Convert AnimationClips to bullet behaviours
    • Make any prefab into a bullet
    • Make use of infinite nesting levels so your bullets also shoot bullets
    • Instant integration workflow: when needed, change your assets in Play Mode!
    2 - Endless design space:
    • No limiting presets: instead, hundreds of combinable parameters that allow for any behaviour. Everything is modular!
      Of course, there are still dozens of example patterns provided in the package so you can use them as a basis.
    • Easily randomize any of these parameters, and/or make it depend on other external data, such as game difficulty.


    • Works with any collider shape: circle, line, composite/custom.
    • Lasers!
    • Homing behaviours!
    • Fully functional in any 2D space: XY, XZ, or any rotated plane.

    3 - Greatest performance available:
    • Handles collisions in the most efficient way, using GPU calculations
    • Handles sprite animations, VFX and SFX
    • Complete pooling system
    • Works on any device with hundreds to thousands of bullets.


    Here are the most important links once again:


    I hope you will enjoy using BulletPro as much as I enjoyed making it! I’d be glad to read your reviews and answer your questions.

    Cheers,

    Simon
     
    Last edited: Nov 14, 2020
  2. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    93
    Great work on this asset Simon! It is really fantastic.

    Imagine that you have a run n gun game and you want a "muzzle flash" sprite animation to play at the emitter origin when a bullet is fired and also you want an "explosion" sprite animation to play once a bullet collides. Is this built into the system, where you can slot these animations in? If not, do you have any recommendations for a good way to do this while using the system? Would you add it to the bullet prefab?

    Thanks for your ideas!!
     
  3. OccularMalice

    OccularMalice

    Joined:
    Sep 8, 2014
    Posts:
    167
    Just got this as part of the megabundle. Will be interesting to try it out. Documentation looks great! One question is the first example in the video isn't in the included scenes. Is it a commercial game or something? What is it from?
     
  4. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    23
    Thank you for your feedback!
    And sorry for the late response - I didn't get notifications from this thread, but I typically reply within one day via mail or discord.

    There are two built-in ways to achieve this, but one is clearly cleaner than the other:
    1) The hacky-but-faster way: you can fire a static bullet at the same time you fire your actual bullet. The static bullet can have its sprite animated to play the muzzle flash, then die.
    2) The clean way: bullets have an option called "Attach Prefabs and Behaviours". It allows you to attach the prefab of your choice as a child of a bullet whenever it gets fired. Not only the prefab can play your muzzle flash effect, but it will also carry a custom script that gets various bullet callbacks, such as OnBulletBirth, OnBulletDeath, and so on. Using this feature is all explained in the part 8 of the docs.


    It's part of a playable browser game I did to showcase the asset's possibilities. In place of the Inktober Challenge, I made one different bossfight a day during October 2020. It's called Doodleshots, and it's still playable for free on my website : click here
    The point was making complete fights in a really short timespan (around 30mn per scene), so the gameplay only relies on BulletPro and nothing else.
     
    Last edited: Aug 23, 2021
    OccularMalice and brittany like this.
  5. leooi

    leooi

    Joined:
    Sep 3, 2021
    Posts:
    9
    can support 3D game?
     
  6. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    23
    Hello, yes you can use it for any 3D game (or 2.5D), as long as the shooting action takes place on a single plane. (ie. the bullets travel along the same plane)
    This plane can be any rotated plane with any direction (not just XY or XZ!), this kind of project is always supported.
    Your bullets can also carry Mesh Renderers instead of Sprites, with the shader of your choice.
     
    leooi likes this.
  7. DoctorRafikii

    DoctorRafikii

    Joined:
    Sep 4, 2021
    Posts:
    1
    Just got this in a bundle, great tool so far! But I have one question. What is the easiest way for a bullet & player collision to kill the player? I have collisions working as I can see the bullet disappear on collision, but it doesn't execute my killplayer function?
     
  8. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    23
    Thank you for your feedback!

    Your bullet dies upon collision because both the Bullet and the BulletReceiver have their "kill bullet on collision" boolean set to true. For enabling other effects, you need to use the Events provided in the BulletReceiver component. For instance, OnHitByBullet() will be automatically invoked and pass a reference to the Bullet component that hit it, as well as the exact position of impact (Vector3).
    upload_2021-9-11_20-23-5.png
    You can plug your code in this event, that's where it bridges with your own game logic so you can use this information and kill your player.

    (Protip: if you need to obtain more data from the collision, your bullet can have any number of Custom Parameters, of any type. For instance, an amount of damage, an elemental property, a text, or even a reference to a ScriptableObject with complex effects of your own.)
     
  9. leooi

    leooi

    Joined:
    Sep 3, 2021
    Posts:
    9
    How to use my own prefab (3d) as a bullet
     
  10. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    23
    Hi, you can attach any prefab to a Bullet Component thanks to Bullet Behaviours, which effectively uses your prefabs as bullets if you turn off the other default modules such as Rendering or VFX.

    To make use of BulletBehaviours, you just have to follow these four steps:
    1) Create a BulletBehaviour script into your project. (Assets > Create > BulletPro > Behaviour Script)
    2) Add this script to your prefab.
    3) Drag that prefab in the "Attach Scripts & Objects" section of your bullets.
    4) Register the prefab in your Scene Setup's Bullet Behaviour Manager.

    The full user manual gives a more detailed explanation in its part 8.
     
  11. unity_ULEttr3FrCE33Q

    unity_ULEttr3FrCE33Q

    Joined:
    Jul 16, 2019
    Posts:
    13
    Why cant I use other than line and circle colliders in bullet receiver? I have straight walls in my game which cant use the circle collider type. Also the line collider only works on y-axis and on top of that it doesn't for some reason register collisions even though the circle collider does
     
  12. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    23
    Hello, although circles and lines are the only two primitives available for performance reasons, you can switch your bullet receiver to Composite Mode, which allows for any shape by combining multiple Circle and/or Line receivers.

    Line receiver is aligned with the object's local Y-axis so you can rotate the object's transform in any fashion. They're precisely designed for your use case (straight walls). It's often a good practice to have this kind of component on a separate GameObject (especially if you intend to use Composite Receivers afterwards), so its Transform can be moved, rotated and scaled at will.

    Finally, if you encountered problems with the collision detection, I suggest you make sure that both your Receiver and your bullets belong to the Scene Setup's plane (ie. make sure they have the same Z-coordinate if you play on the XY plane, or the same Y-coordinate if you play on XZ, and so on).
     
    unity_ULEttr3FrCE33Q likes this.
  13. leooi

    leooi

    Joined:
    Sep 3, 2021
    Posts:
    9
    Homing on XZ plane not working.
    upload_2021-9-29_18-7-21.png
    the enemy bullet is not chasing my player, it spawn away from player.
     
  14. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    23
    We just discussed this in Discord, but I'll also answer here for future reference: the issue has been found and the fix will be deployed in version 1.3.1.
    It should most likely be available by next week. (Asset Store validation time)
    Edit: 1.3.1 is now available, the issue has been fixed!
    My sincere apologies for the inconvenience, thank you for your patience!
     
    Last edited: Oct 6, 2021
    leooi likes this.
  15. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    93
    I'm making a platform shooter and not sure how I feel about tracing around all my terrain with bullet receivers. Is there a way to use Unity's collision system with Bullet Pro? The tilemap can automatically make colliders which is very expedient. But I am also wondering about the performance benefit of your system. To go to the trouble of having this custom collision system, it must be much more performant. In your tests, what is the performance benefit compared to using Unitys collisions?
     
  16. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    23
    You could add regular Unity colliders to the bullets, through the Bullet Behaviour system which lets you attach any prefab to a bullet - but it's really not the intended use, and the Receiver system exists because Unity's collision system is too heavy for handling hundreds of bullets.

    If you're using TilemapCollider2D, an alternative would be using Bullet Behaviours but without colliders, and then process collisions with the OverlapPoint() function from the TilemapCollider2D class.
     
  17. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    93
    When you are using Bullet Pro to make a platform shooter, how do you recommend handling collisions between the player and the ground, walls, ceiling, platforms, etc? Use regular colliders on the player and terrain and then also use bullet receivers on the player to collide with bullets and also line the terrain with bullet receivers so bullets will hit the terrain as well?
     
  18. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    23
    Exactly, collisions between the player and the ground/walls don't involve bullets, so they should use Unity's default collision system. There's no interaction with BulletPro here.
    Then, on top of that, you add BulletReceiver components to anything that could get hit by a bullet (such as player hitbox or obstacles).
     
    brittany likes this.
  19. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    93
    Thank you for your help! I am wondering if a bullet receiver can be attached to a tile, so that when I draw or edit my terrain tilemap, the bullet receivers are placed along with the tile automatically. That would make it much more manageable. I'll have to look into that. From your end do you see any issue with doing it that way? Thanks again for helping me understand the system.
     
    AlbinosMou likes this.
  20. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    23
    You're welcome!
    There should be no issue with placing bullet receivers directly on tiles, just make sure you don't exceed the receiver limit as set in your Project Settings.
    This limit defaults to 200 at once, you can manually raise it if needed. (Edit -> Project Settings -> Bullet Pro)
     
    brittany likes this.
  21. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    93
    I'm setting up a basic Emitter Profile that just shoots a single shot straight forward (to the right). Originally the bullet was being shot straight up and I didn't see anyway to change that in the emitter profile settings, so I rotated the bullet emiiter object by -90 on the z axis. Now the bullet moves in the correct direction, but of course the sprite is now also rotated and looks like its pointing down instead of straight ahead. Where is the setting to control this? I looked around and didn't notice anything but I'm sure I just missed it.
     
  22. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    23
    I'm not sure I understand the question - regardless of any object's rotation, the bullet will always move towards its own local "up" vector, so you should always have a correct sprite orientation as long as the texture you're using shows the bullet facing up. Is that the case?
    Then, the emitted bullet will have its rotation impacted by its parent bullet (if any), the shot it belongs to (if there's a parent bullet), and the bullet emitter transform itself.
     
    brittany likes this.
  23. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    93
    Ah ok so I have to draw my sprite that way. My game is horizontal so I was drawing all my bullets in a horizontal way. I will rotate the bullet in my graphics program and import the new sprite. Thank you for explaining that to me!
     
    AlbinosMou likes this.
  24. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    93
    I have a Bullet Receiver that is a Line. When I shoot bullets at it around the center, they collide properly, but if I move towards the last quarter of the line, on either side, top or bottom, the bullets just go through the line. I can look in the scene view and see the line is there but the bullets only collide in the middle half. What could be causing this?

    Edit: It is weird, I adjusted the collider on the bullet to make it more accurately fit the shape of the bullet and now it collides on the sides, but there is a small section in the middle where the bullets go through the line.
     
    Last edited: Jan 21, 2022
  25. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    23
    This looks like a case where your two objects do not have the same Z-coordinate, which can create errors in the collision detection. It might be a bit counter-intuitive, but the Z-coordinate is actually used in calculations, so your gameplay plane can be rotated in the event you would want to make a 3D game.

    To clarify, you need to make sure every bullet and receiver has the same depth. If the problem persists, maybe you can also find help in the "Troubleshooting" part of the manual.
     
    brittany likes this.
  26. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    93
    I checked the bullets and the receiver and they are all on a Z position of 0. Nothing in Troubleshooting seemed to apply to this case. If I made a small demo project would you be willing to look at it?
     
  27. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    23
    Sorry to hear this, it was the most common source of this problem. Sure you can send me a demo project and I'll look at it!
     
    brittany likes this.
  28. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    93
    Thank you! I sent the project.
     
    AlbinosMou likes this.
  29. Grimshad

    Grimshad

    Joined:
    Dec 28, 2011
    Posts:
    9
    Does this support raycast shots or only projectile spawning?
     
  30. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    23
    This is only for projectile spawning (and behaviour of said projectiles), although the projectiles could be invisible and line-shaped, which would be equivalent to a raycast shot - but that would not be the first intended use for this package, so I can't guarantee it's perfectly optimized for this.
     
    Last edited: Feb 1, 2022
  31. MrJBRPG

    MrJBRPG

    Joined:
    Nov 22, 2015
    Posts:
    40
    If I want to do a shot limit from the bullet emitter, like some player shots, How would it be possible to check the number of bullets belonging to the player at the emitter source before being permitted to shoot a number of shots? There are games that force a shot limit on player characters / objects.
     
  32. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    23
    Hi, you can find this information from the BulletEmitter component: there's a
    List<Bullet>
    called
    bullets
    that stores every bullet (both directly and indirectly) fired by this Emitter. By counting the number of bullets in this List, you can know how many bullets have been fired since the beginning, unless some of them can die early on.
    Debug.Log(myEmitter.bullets.Count);

    (Link to relevant Scripting API spreadsheet)

    If you need more accuracy, it's also possible to add a BulletBehaviour on your emitter's root bullet, and have this behaviour track fired bullets from its
    OnBulletShotAnotherBullet()
    callback.
     
  33. JackLeiXuan

    JackLeiXuan

    Joined:
    Aug 18, 2022
    Posts:
    1
    Does the "Shot" module support dynamic parameters?
    I tried many times, but the dynamic parameters didn't work, and I couldn't shoot bullets.:eek:
    upload_2023-7-30_10-48-49.png
    upload_2023-7-30_10-49-38.png
     

    Attached Files:

  34. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    23
    Hi, the inspector says "??? bullets" and "cannot compute" because since the parameter is dynamic, outside of runtime, the inspector has no way to know in advance how many bullets your shot will contain, which makes it impossible to draw the preview. But it doesn't mean the shot won't work in runtime, it's actually functional! So, there might be another error in your asset.
    • Is the "SHOT_COUNT" parameter correctly stored in the Root bullet instead of the child one?
    • Is the parameter an integer instead of a float?

    Also, the code shown in your first screenshot refers to something else entirely, it's for dynamic references to a Shot object (such as the "Shoot" instruction of your Patterns), so it can't be the source of your issue.

    I hope it helps :)
     
  35. AndrewFaraponov

    AndrewFaraponov

    Joined:
    Feb 26, 2018
    Posts:
    2
    Hi! Thank you for such a great asset! Can I use the Bullet Pro for making Laser, and how? I ask because I found the laser sprites in the demo assets and didn't find any usage of this in the demo scenes. Or its just a bullet laser-like?

    UPD: Already gor solution. No worry )
    Set Attach to emitter and then emission loop wait to 0.002 seconds, then sprite to bullet - laserBeam or smthng looks like that )
     
    Last edited: Nov 24, 2023
    AlbinosMou likes this.
  36. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    23
    Thank you for your feedback! Indeed, there's many different ways to make Lasers. First of all your solution works well, then you can also set your bullet collider shape to Line (instead of Circle) so the whole laser is contained in one single bullet.
    The user manual also has a page dedicated to handling Lasers (part 4.10, or page 29). By scaling the bullet before increasing its speed, you can imitate the "growth" of a laser beam.
     
    AndrewFaraponov likes this.