Search Unity

Shmup Baby

Discussion in 'Assets and Asset Store' started by EbalStudios, Sep 18, 2018.

  1. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    The bullet system is entirely based on particles which is highly performant, if you want to use an animated sprite with that system you will need to write a custom script/shader for animating the material texture. Animated tiled texture wiki

    A temporary work around would be to use a missile weapon with a turn speed of zero instead of a path/radial particle weapon, but please note that missiles are not pooled, which means they are instantiated and destroyed whenever fired and would create garbage which is not ideal for a bullet which might be spawned at a very high frequency. But if you have a special type of weapon that is not used very often, perhaps it is something you can use.
     
  2. Phantasie

    Phantasie

    Joined:
    Sep 16, 2015
    Posts:
    11
    Thanks. I ended up using a TextureSheetAnimatio particle module, works well.

    How could prevent a particle from being destroyed when it collides with a RigidBody? I thought maxKillSpeed would have, but it dosent appear to.
     
  3. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    Glad you found a way for animating the particles.

    Yes, you are correct, maxKillSpeed does indeed keep the particle alive after collision, but if you are changing the particle collision module max kill speed and not seeing any results it is because it is set inside the script. To change this you can do the following:

    Open up "PathWeapon.cs", go inside the initialize method, down to around line 179, there you should see:
    Collision.maxKillSpeed = 0;

    Comment out that line and add a lifetime loss instead:
    //Collision.maxKillSpeed = 0;
    Collision.lifetimeLoss = 1;

    You should be ready to go! (This will also need to be applied to the radial weapon)

    The lifetimeLoss line makes sure the particles are destroyed when they hit the enemy layer, if it is not active you will get strange results of things bouncing off.

    What you have now is particle bullets that are only destroyed when they hit the enemy layer and pass through any other object even if it has a rigid body. (I hope this is what you were looking for)

    Note1:
    Please make sure to open your weapon stage at least once so that changes are initialized, otherwise no changes will happen and you might be wondering why nothing changed, also you can double check your particle settings by hitting play button, then afterwards selecting the player/enemy which has been instantiated in the scene and seeing if it has the right settings or of its settings changed from what you set.

    Note2:
    If you wish to add more layers for the particles to collide with, you can play with the Collision.collidesWith line but it's a bitWise sort of thing, here is a sample:

    int layer1= 1 << (layer1number);
    int layer2= 1 << (layer2number);
    int layersToCollideWith = layer1| layer2;

    Collision.collidesWith = layersToCollideWith;
     
  4. Phantasie

    Phantasie

    Joined:
    Sep 16, 2015
    Posts:
    11
    Hi
    Thanks for the response. I really appreciate the detail you went into.
    I was looking to create a laser that went through enemies, but still did (one) tick of damage.
    I ended up using a sprite instead, based off a missile, as it gave me more control.

    Also, I believe there is a small bug in LevelController.cs in the method SetPlayerBound().

             
    if (PlayerBoundOption == PlayerBoundOptions.OffsetGameField)
    {
    Rect PlayerField = OffsetRect(GameField, PlayerFieldTop, PlayerFieldBottom, PlayerFieldRight, PlayerFieldLeft);
    player.mover.Boundary = GameField;
    }


    The player Boundary should be set to the local variable PlayerField.

    Thanks!
     
    EbalStudios likes this.
  5. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    Thanks for spotting that one! No matter how many times something is tested or used, a thing or two always slip by. I Will double check this is corrected in the second version.
     
  6. Phantasie

    Phantasie

    Joined:
    Sep 16, 2015
    Posts:
    11
    That's how game dev works - always bugs :).

    By the way: I've been a game dev since PS1/N64 days - your Shmup Baby code impressed me: its clearly laid out, easy to understand and well architected. I was very surprised - I've modified it a fair bit already, but your proper use of events and keeping the role of each class contained makes it very easy to extend/add features. I was very impressed.
     
    EbalStudios likes this.
  7. FlyVC

    FlyVC

    Joined:
    Jan 5, 2020
    Posts:
    30
    I realized that there is only an orthographic Camera script. It would be nice to have a perspective effect on some bigger background objects. I already tried removing the forced orthographic setting and camera stacking but it becomes a mess quickly.
    For example, as soon as I add a 2nd camera, the game-field and the controls are S***ed.
    Do you have a suggestion on how to achieve this without breaking too much?
     
  8. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    I feel your pain!
    I have specifically mentioned the lack of a perspective camera in the description because I understand this is a feature that people would expect and I wanted to make it clear from the get go that it is not available.

    The issue of a perspective camera is far more complicated than users initially imagine, it's not a matter of switching the camera orthographic setting off!

    Let me elaborate, if you have a perspective camera, there are ways to write a script to calculate the camera position and game field in regards to the camera which is the easiest part of the problem, but what about shooting targets on different layers?

    How to put this clearly, imagine you have an enemy tank on the background and at the same time an enemy fighter jet flying up in the sky. With a perspective camera, things which seem on top of each other are not on top of each other in world coordinates, and things which do not seem on top of each other might be.

    If you haven't encountered this problem, please just open up Unity, place a cube on position say: (5,0,0) and another cube on (5,0,5) and the camera on (0,0,10) and you will see what I mean. (technically they are on top of each other, but when you have a player shooting bullet will appear as if they are not hitting their targets.)

    There are hacks to "solve" it of course! I have even started one with the next version before postponing it for further future updates until I first sort out the main requirements and see what levels of sales the second version makes before committing more effort to it, the simplest one would be basically to put all targets on the same depth but even then you have to have different fields for the background and playground etc and it's not as straight forward as it looks like.

    If one is doing a single game with a depth he agrees on and known layers it's a lot easier to tackle these issues, but this is a system where users come up with different depths, dimensions etc.. so solutions need some thinking and planning.
     
  9. jynell

    jynell

    Joined:
    Nov 25, 2020
    Posts:
    1
    Hello, I followed the first five minutes of the first tutorial video and when I hit play to see the player move over the background, my screen is black and many errors are spammed:


    Instantiating a non-readable 'SpaceBlueVertical_1' texture is not allowed! Please mark the texture readable in the inspector or don't instantiate it.
    UnityEngine.Object:Instantiate(Object, Transform)
    InvalidCastException: Specified cast is not valid.
    ShmupBaby.SeamlessLayerControllerVertical.CreateBackground (UnityEngine.Object prefab, System.Int32 index) (at Assets/ShmupBaby/Scripts/BackGround/Seamless layer/SeamlessLayerControllerVertical.cs:51)
    NullReferenceException: Object reference not set to an instance of an object
    ShmupBaby.SeamlessLayerControllerVertical.Update () (at Assets/ShmupBaby/Scripts/BackGround/Seamless layer/SeamlessLayerControllerVertical.cs:25)
    Screen position out of view frustum (screen pos 632.000000, 633.000000) (Camera rect 0 0 879 634)
    UnityEngine.SendMouseEvents:DoSendMouseEvents(Int32)

    I went back and watched those 5 minutes very carefully again, and am fairly certain I didn't miss anything. What is going wrong? Can this be remedied? Am I using the wrong version? (2019.4.15f1)
     
  10. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    I am just guessing here but I think you have used a texture or a sprite instead of a prefab as a background.
    You will need to use a prefab instead of a texture directly, to create a background prefab, first drop a sprite into the scene then drop put back into the project view or simply use one of the existing prefabs.
     
  11. Phantasie

    Phantasie

    Joined:
    Sep 16, 2015
    Posts:
    11
    Hi

    I've been adding a fair bit of functionality to the already impressive ShmupBaby source. If you want, I can edit this thread with a brief summary of additions for you to consider with future releases. The additions range from gameplay to editor workflow.

    :)

    Edit: 12/23/2020 Ver 1

    The workflow to setup Waves is rather complicated, and editing waves (via an array in inspector) is frustrating due to Unity's poor support for arrays in the Inspector. For example: You cant re-order waves (ie drag from one index to another). You cant delete a specific wave. You cant duplicate a wave. You need to fully expand and look at the properties to know "what" a specific wave is doing, etc

    I implemented Reorderable Arrays that solve most of these issues:



    Other changes
    - A wave can optionally not start until the previous has finished. This is useful so you don't have to estimate how long the current wave will take.
    - Sometimes you want to test a specific subset of waves. Added a "Disabled" property on WaveCreationData to do that.
    - Added custom Context buttons to Enable or Disable all Waves. Typical workflow with this: Disable all waves for the level. Manually enable the one im working on and the one before it. Test. Do they "mesh" together? Tweak/Balance. Start creating the next wave - repeat.
    - Added custom display name for each WaveCreationData object in the Waves Array: Display Name (or Wave Game Object Name if DisplayName is Empty) + IF it waits for last wave to complete + time to wait to next wave + If this wave is disabled. Makes understanding a levels waves much easier instead of opening every array element.

    Edit 12/23/2020 Ver 2

    - Waves now have an optional Drop property. Waves listen for OnDestroyStart for each enemy they spawn. If all of those enemies fire this event (they died as opposed to removed from offscreen), the wave fires a WaveAllEnemiesKilled event. The Level Controller listens for thie and Spawns the corresponding Drop at the location of the last enemy killed.
    - To reduce number of enemy prefabs, each enemy has ALL movers on it. When a wave spawns an enemy, it disabled all movers. Then the wave subclass enables only the mover needed for that wave (CurveWave = CurveMover). I know this isnt generic, but in most cases it makes sense. It saves duplicating prefabs just to change the mover. I prefer less enemies :)

    Currently working on:
    - Considering allowing nesting of Waves. It would be nice to make a Wave of Waves for both organization and reuse.
    - Considering a wave modifier, where you can generically modified the properties on the enemy for a specific wave. I dont want to make duplicated enemies: One that shoots, one that has a shield, etc.

    I've added quite a bit more, but these were the things I did today and they really improved level building.
     
    Last edited: Dec 24, 2020
    EbalStudios likes this.
  12. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    Sounds awesome, I could certainly use a solid programmer's expertise. At the moment I am just trying in my best capacity to finish the second version to release it, almost spent a couple of weeks debugging things that only came up when test building more demos.
    Currently I am at the phase of final tests, making demos, documentation and tutorials so I will be quite reluctant to push the release date any further by adding features. Let me just finish up the second version. I am quite curious to know what you think of it since you are already familiar with the first one. the code has been completely changed for the most part. If you are interested, after it's released I could send you a PM to talk about it more, see what ideas you have and what you've been working on or even arrange for a quick call.

    The plan so far is to finish up the update for Shmup Baby, take a break! Then get back to making the updated spaceships creator pack, only afterwards I will see how much effort I can put back into Shmup Baby (It will have a name change with the second version as well :)), making the second version of this pack has been more of a challenge than anything else and to have the necessary skills to make my own games.

    Meanwhile, I don't know if you have already written one or not, but it's one of those things that I have to hustle for :D, if you can write out a review that would help out tremendously :p

    I will keep you posted as soon as I can share more about the second version.
     
  13. Phantasie

    Phantasie

    Joined:
    Sep 16, 2015
    Posts:
    11
    Will do! I wrote a review just now.

    And sure, id love to preview the new code. Happy to discuss.
    Ive already modified this current code alot, so I doubt id use the new version for the current game im making as merging the new changes would be challenging.

    Ill keep editing the previous most with other additions I make. Maybe youll find the usefull and consider implementing. My code is probably not generic enough to include with your package, though.
     
    EbalStudios likes this.
  14. Phantasie

    Phantasie

    Joined:
    Sep 16, 2015
    Posts:
    11
    Minor bug:
    The Duplicator weapon mod - when applied to enemies - does not work when HandleWeapon.WeaponStartDelay > 0
    The duplicated weapons start firing immediately because _duplicates.IsFiring = true; is called in Start() rather than waiting for the MyWeapon parent/source they are duplicated off to start firing.
    This results in a the primary weapon firing out of sync with all the duplicated weapons.

    The duplicated weapons do listen for the OnStartFire event on the Parent. So you would think the _duplicates.IsFiring = true is redundant and could be commented out.

    This introduces a new bug:

    If there is no start delay, the Duplicated Component is created AFTER the HandleWeapon mode. Thus they miss the first OnStartFire() event and never start firing.

    The proper fix (I think) is to use the parents IsFiring on Start() of the WeaponDuplicator_Mod:
    _duplicates.IsFiring = MyWeapon.IsFiring;





     
    Last edited: Dec 27, 2020
    EbalStudios likes this.
  15. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    Thank you for not only spotting it and letting me know, but for providing a viable solution as well (Thumbs up)
     
  16. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    Just noticed the edits, all the ideas and implementation seem very rational and quite useful. All those would definitely be taken into consideration for future updates.
     
  17. Hibito555

    Hibito555

    Joined:
    May 17, 2019
    Posts:
    18
    Hello My master
    I opened the MainMenu,don't have any edits,but An error occurred
    How to solve it?
     

    Attached Files:

    • 000.PNG
      000.PNG
      File size:
      38.7 KB
      Views:
      300
  18. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    I just tested it to see why this is occurring, this is happening only because of the difference in Unity versions, the main menu scene was saved in an older version of Unity so when you open it with the newer one it gives you this message.

    This will not cause any issues, simply change anything in the scene (rename something, change a number, move something, etc..) and save the scene. Now when you open it the message will be gone.

    The second version of Shmup Baby have been already uploaded and now is only awaiting the Unity asset store's approval (It will be a paid upgrade). The second version will be compatible with Unity versions 2019.4 and upwards and have been completely rewritten for the most part, to learn more on the details you can check the thread or the last post made here: https://forum.unity.com/threads/shmup-baby-version-2.989248/
     
  19. Hibito555

    Hibito555

    Joined:
    May 17, 2019
    Posts:
    18
    I changed the game manager but appear warning,Does this have an impact?
    expect :)
     

    Attached Files:

  20. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    No it won't cause any problems, it's just a recommendation but if you really do not like seeing it:
    Open up "MainMenuUIManager.cs" go to line 378 and replace levelButton.parent = Content.transform; with levelButton.SetParent(Content.transform);

    and it should solve it for you.
     
  21. Hibito555

    Hibito555

    Joined:
    May 17, 2019
    Posts:
    18
    Thanks for the answer
    But i have new problem,The High score counter does not work
    What could be the problem?
     
  22. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    The high score counter only works when you have the correct build settings and are building a complete game with a main menu. If you just play a single level without building a game with a main menu it won't save any score because it won't have access to the save data to save it.
     
  23. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    Just uploaded Version 1.22, the update is mainly for new users to fix the warning/error message that Hibito555 pointed out would appear on the more recent versions of Unity (Just a simple lighting rebuild and camera update). I also changed the format of the sound tracks into .OGG to save space.

    Version 2 Information
    Version 2 has been uploaded and is awaiting Unity Asset Store's approval. It should be online within a week or 2 depending on the Unity Asset Store's submission queues.

    The support thread for it will be this one: https://forum.unity.com/threads/1030870/
    You will be able to upgrade from the first version into the second one. If you still didn't purchase Shmup Baby and are not in a hurry for building a game, I would recommend waiting until the second version is out so that you do not have to rebuild your levels or watch 2 tutorial series. Once the pack is approved I will link the tutorials and documentation for you to get more information.

    Transitioning from the first version (AKA Shmup Baby)
    The second version has been completely rewritten from the ground up, very few scripts remain from the first version. This means if you intend to transition the project you created in the first version to the second; you will need to setup completely everything again from the start.

    New Features
    • Pooling system, enemies, bullets, missiles, effects, player, background, background objects and pickups are all pooled automatically*.
    • Global difficulty system.
    • Multi-phased boss system.
    • Weapon system which is based on pooled game objects in addition to the particle weapon system.
    • End sequence options for the background layering system.
    • A preview button for the backgrounds.
    • More options for spawning random background objects.
    • Different play fields which you can see in the editor.
    • Different wave system based on a scriptable object, for movers which are not a curve or a waypoint mover, the starting direction will be set automatically.
    • A limited option for spawning ground enemies (Only works with the finite level)
    • SFX for all agent events (including different types of player pick ups)
    • Agent events are now separated (Player components only show player events while enemy components only show enemy events).
    • Disable after time option for the enemies.
    • Camera zoom and tracking effect.
    • Camera shake effect (camera must be zoomed in for the shake effect to work.)
    • Invincibility option for all agents with an option for the bullets to pass through if invincible.
    • Coin collection in addition to score. (currently coins are not used and there are no options to buy or unlock anything, but the coins picked up are saved in the save file and if you want to add your own custom written scripts you can feel free to use the saved coins value in the game manager).
    • Added more debugging messages in case a user forgets something.
    • IMO the script is now a bit more organized and easier to read and modify.
    Note*: the pooling system knows what to pool automatically, you might have to add the initial value of how many to pool, but if needed the pool will expand automatically, but no culling feature has been implemented. All pools inherit from the same base and in theory it should be easy to add your own culling mechanism if you know how to code and deem this an essential feature.

    Lost Features
    While additional functionality have been gained in the second version, others might have been lost. Adding a pooling system in the second version, meant that it was a lot harder to keep all the features which were easy to do in the first version because everything was instantiated and destroyed and not spawned/despawned.
    • You cannot now fire or damage missiles.
    • Rotation and flipping options for background have been removed.
    • The particle weapon duplicator and rotator have been removed, both the path and radial weapon have now been merged into one which has a radial option, one down side though is that if you use the curve option, it will not apply the same way it applies when you previously had a path weapon which was duplicated.
    • Objects control component have been replaced with a component called FX spawner, Yes! I know and understand that the objects control component has been exceedingly popular, but it could not be easily used with a pooling system that reuses everything and it would take a lot of effort to make it work. The FX spawner should give you everything you now need and maybe later I can see if there is any additional functionality that can be added.
    • There used to be two types of UI, and a complete player select with turn table, to make things easier to update, understand and modify, the second version uses the same unified UI and the player select scene has been merged with the main menu scene and the turn table replaced with an image based selection that is more generic for different types of games.
    • I removed the Ads manager, I actually have kept a script that works with Unity versions 2019.4 and upwards but I didn't include it with the pack because I simply didn't want to be blamed every time Unity or for whatever reason beyond my control Ads didn't work. (might post it later on on the forums if someone really wants it, it is basically the same as the first version, only without the platform dependent lines)
    • The player mover now does not have its own field and will move inside the play field.
    • When an enemy makes a drop, drops now move instantly into their position instead of gradually from the center of the enemy towards their expected position.
     
  24. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    Shmup Boss (AKA Shmup Baby 2) has been released!
    https://assetstore.unity.com/packages/slug/187012

    I just activated the upgrade option, anyone who has purchased Shmup Baby should be able to make the upgrade only for 15$, those who purchased Shmup Baby within the last 3 months should be able to download the upgrade for free.

    Please do make backups of your projects before upgrading!
    Do watch the tutorials, check the documentation before making the transition to make sure the second version will be useful to you, you can find the new tutorials and documentation here: https://forum.unity.com/threads/shmup-boss-support-thread.1030870/

    I tried my best to test Shmup Boss before uploading, but as it is to be expected from any new release, there might be some small thing here and there that might have slipped, if there is anything that needs fixing I will try all I can to work it out.

    Version 2.01 which improves performance and fixes a minor bug in the boss system has been uploaded and should be online in a day or 2

    The first version (Shmup Baby) has been deprecated and all development will go into the second version (Shmup Boss!)
     
    Last edited: Jan 29, 2021
  25. Hibito555

    Hibito555

    Joined:
    May 17, 2019
    Posts:
    18
    Hello My master
    I set Unity Ads,but Ads Manager no change,
    How to solve it?
     

    Attached Files:

    • 000.PNG
      000.PNG
      File size:
      30.2 KB
      Views:
      301
    • 001.PNG
      001.PNG
      File size:
      27.8 KB
      Views:
      301
  26. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    Please download attached script and replace the old ads manager with the attached one below.
     

    Attached Files:

  27. Hibito555

    Hibito555

    Joined:
    May 17, 2019
    Posts:
    18
    An error occurred
     

    Attached Files:

    • 0000.PNG
      0000.PNG
      File size:
      23.7 KB
      Views:
      296
  28. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    What version of Unity are you using?
     
  29. Hibito555

    Hibito555

    Joined:
    May 17, 2019
    Posts:
    18
    2019.4.15f1
    Should upgrade him?
     
  30. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    No, don't upgrade. Give me 30 mins, will try to figure it out.
     
  31. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    So sorry, I made a small mistake in the last script I have sent. The 123456 in the script game ID should of been "123456"
    Download this new one over here, replace and restart Unity and let me know how it goes
     

    Attached Files:

  32. Hibito555

    Hibito555

    Joined:
    May 17, 2019
    Posts:
    18
    It looks very good.
    I love you:)

    Also, I want to buy Shmup Boss,He can also support UNITY Ads?
     

    Attached Files:

    • 000.PNG
      000.PNG
      File size:
      240.2 KB
      Views:
      292
  33. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    不客气 (Bù kèqì)

    I removed Unity Ads from Shmup Boss because I always get so many questions about Unity Ads. Unity Ads might not work sometimes from things that are not my fault and I would get blamed for it.

    But I have an updated ads manager script which you can use with Shmup Boss. I didn't include it so that no ask me questions about Unity Ads anymore :D But if you buy Shmup Boss you can add to it this script, and inside the main menu add the ads manager script and it should work the same as with Shmup Baby.

    Attached below is the Ads Manager for Shmup Boss.
     

    Attached Files:

  34. Heero888

    Heero888

    Joined:
    Jun 18, 2017
    Posts:
    57
    Hi Ebal,

    In Shmupbaby, how can i make player missile able to damage enemies missile when they collide?

    Thanks,
    Wai Fung
     
  35. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    Hi Wai Fung,

    You can't.

    For a start, missiles do not have a rigidbody, which means collisions will not be detected between missiles. In addition, even you add rigidbody and allow for player/enemy missile collisions, you will still have to make the enemy missiles listed in the pool so that the player missiles can find them and target them, you also need to set up a priority system, otherwise it is possible that the player missiles will target enemy missiles and forget about the enemy itself.
     
  36. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    Answer in regards to Wai Fung post in Shmup Boss thread on January 27th 2023

    Overlapping images is an extra feature that was not included in Shmup Baby.

    To modify the code you will probably need to change the code in the: "SeamlessLayerControllerVertical.cs" or "SeamlessLayerControllerHorizontal.cs" depending on your level type.
    Inside the "CreateBackground" method, line 55 where the background transform position is being set, you could probably change the position a bit to make it offset.

    Please note that this is just a quick deduction I made after opening the code and I didn't actually test this to see if it would work properly or not since this is a new feature request and not a standard support question. Thank you for your understanding
     
  37. Heero888

    Heero888

    Joined:
    Jun 18, 2017
    Posts:
    57
    Hi Ebal,

    I notice something odd, and tested on a fresh copy of ShmupBaby

    1) make a standard enemy with Enemy.cs, CurveMover.cs, RigidBody2D, and a Collider2D
    2) spawn the enemy with Curve wave in a game
    3) while the game is running, do not kill the enemy
    4) try to disable the enemy gameobject either manually in inspector or in another script
    5) the disabled enemy gameobject will be destroyed automatically in the next frame.

    This also happens with DirectionalMover.cs / OrganizedWave.cs

    Is this a normal behavior? How can I prevent the enemy from getting destroyed when disabled? Where in the code triggering this behavior?
    I want to temporary disable the entire enemy game0bject instead of destroying it.

    Thanks,
    Wai Fung
     
    Last edited: Feb 3, 2023
  38. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    This is caused by the "DestroyByRegion.cs" script. You will find this component usually attached to the LevelController game object.

    Basically when you deactivate an enemy, the destroy by region script will think the enemy has exited its region and will destroy it!

    You will find the destroy line in the OnTriggerExit2D method inside the "DestroyByRegion.cs" at line 130 to 134

    Now how you solve this is up to you, maybe you could create multiple colliders on the border and change the function to OnTriggerEnter2D instead of on Exit or any method you can think ok.
     
  39. Heero888

    Heero888

    Joined:
    Jun 18, 2017
    Posts:
    57
    Found it. I should've asked earlier. I spent 1 week looking for that lol.

    Just a feedback. Not sure if pooling is done in Shmupboss. Optimization is quite an issue running your setup and assets on mobile phone. So I am creating pooling system on my own now. I have already pooled all FX, that alone boosted from 17FPS to 45FPS in my game setup.

    Some additional questions:

    PoolManager.cs is only to track enemies are alive and their location, and it is not a pool for avoiding spamming instantiating enemies. Am I correct?

    Making enemy pool is particularly hard because HandleWeapon.cs unparents the weapons when DestroyWeapon() is triggered for the purpose of BulletRemainTime. So I am only making pool for enemies without HandleWeapon.cs attached. Any thoughts on this?

    I really want to switch to Shmupboss but too bad I have already made too many custom mods to your code in Shmupbaby. Is there an enemy pool in Shmupboss?
     
    Last edited: Feb 4, 2023
  40. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    Yes, I completely rewritten Shmup Boss mostly to create a real pool and to make the script more organized. I am not sure how you can go about adding a pool with Shmup Baby. I too have found it to be too much effort to create one for it and thought it was easier to just rewrite it.

    As you have already figured it out, Shmup Baby's PoolManager is not a real a pool, it's to be used for things like trackers and number of enemies. Shmup Baby is heavily dependent on instantiating and destroying which is not good.

    It is actually quite painful for me to even talk or discuss Shmup Baby, there is nothing I would like more than to put it behind my back completely. I discontinued it 2 years ago. At this point I think you are probably the only one still using it :D

    At the moment I am putting all of my effort into the new update I am working on in which I am completely rewriting Shmup Boss again.
     
  41. Heero888

    Heero888

    Joined:
    Jun 18, 2017
    Posts:
    57
    haha alright. I'll ask question only if I have to. Too bad I am stuck with Shmupbaby. If my game makes money, I will definitely migrate to Shumpboss in my next game.

    Actually would you have a published game on GooglePlay? I want to play your game, it must be good.
     
    Last edited: Feb 4, 2023
  42. EbalStudios

    EbalStudios

    Joined:
    Nov 20, 2016
    Posts:
    444
    Haven't published anything yet, If I ever do I will let you know. Good luck with everything.