Search Unity

Spawner - Free

Discussion in 'Assets and Asset Store' started by CorruptedHeart, Jan 24, 2012.

  1. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379

    This system assists in the spawning of enemy, monsters and so forth. It makes it easy to spawn in various waves and other forms. It is fairly easy to set up, with only a couple changes required for your enemy units.

    Version: 2.0
    Source Code: C#
    Unity Version: 3.4.1 Free
    Price: Free
    Asset Store Link
    Web Player Example

    Features:
    • Works with Unity free
    • Supports 4 different units/levels with a enum to select which unit to spawn
    • Custom Inspector
      [*]Supports the following spawn modes:
    • Continual (attempts to keep the number of spawned units at the maximum set)
    • Once (spawns up to the maximum in one shot)
    • Wave (spawns in waves, once all are dead, spawns new wave)
    • Timed Wave (spawns in waves, once the time is up, spawns new wave)
    • Time Split Wave (spawns in waves, once all are dead, waits time then spawns new wave)
    Change Log:
    Version 2.0:
    • Changed the way spawned objects are assigned the owner (The Spawner object), now requires a SpawnAI or subclass of it on the spawned object
    • Small bug fixes
    Version 1.7:
    • Improved Pool Manager integration, now prespawns up to the Total Units limit to speed up consecutive spawns.
    Version 1.6:
    • Uses a coroutine instead of Update to control spawning
    Version 1.5:
    • Support for Pool Manager
    • Support for adding a transform to specify where to spawn, if it is null (empty) uses the spawner GameObject
    • Small improvement to the SpawnAI component.


    Custom Inspector​

    Regards,
    Garth (Corrupted Smile Studio)
     
    Last edited: Nov 20, 2013
  2. Avanger

    Avanger

    Joined:
    Aug 26, 2011
    Posts:
    258
    i didnt understand what him duing
     
  3. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    I'm not sure I understand the problem?

    Garth
     
  4. Avanger

    Avanger

    Joined:
    Aug 26, 2011
    Posts:
    258
    what i can do with this script? for what is it?
     
  5. snortop

    snortop

    Joined:
    Dec 16, 2011
    Posts:
    194
    Still what you talking about.. the is no script here.

    It hasn't been released yet, and will be on asset store.
    When he release it.

    and if you read again, it a spawner... it "Spawn" monster.
     
  6. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    Snortop is correct. It makes it easy to spawn enemy units, monsters and so forth. It can spawn unit in various ways.

    I will put up a web player showing examples of units spawning.

    Garth
     
  7. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    Here's a simple webplayer example that allows you to change betweeen the various spawner modes.
    Spawner Test

    It's fairly simple.

    Garth
     
  8. ecnalyr

    ecnalyr

    Joined:
    May 23, 2010
    Posts:
    38
    Thank you very much for providing a nice free asset.
     
  9. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    Doing my best to give back to the community.

    Garth
     
  10. cheezorg

    cheezorg

    Joined:
    Jun 5, 2008
    Posts:
    394
    Garth, this is great, thanks very much.
     
  11. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
  12. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    If those of you who have downloaded Spawner, could please review it on the Asset Store or post up some feedback here it would be awesome.

    Garth
     
  13. dreamlarp

    dreamlarp

    Joined:
    Apr 22, 2011
    Posts:
    854
    This is fantastic. I was planning out way to create global gm spaned events. ty ty.
     
  14. mr_Necturus

    mr_Necturus

    Joined:
    May 17, 2010
    Posts:
    2,956
    Hm... What to do?.. As usual steal it and distribute on pirate forums.
     
  15. runonthespot

    runonthespot

    Joined:
    Sep 29, 2010
    Posts:
    305
    Sounds cool. How do you determine where things spawn?
     
  16. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    @RunOnTheSpot right now it uses the position of the GameObject that the spawner component is on. However, if it is required I could expose a Transform variable that will determine where to spawn. Then if the variable is null (empty) simply use the previous method.

    @mr_Necturus I can only assume that you were joking, since it is a free asset, might as well just download it from the Asset Store that way you keep up to date with any bug fixes and updates.
     
  17. mr_Necturus

    mr_Necturus

    Joined:
    May 17, 2010
    Posts:
    2,956
    Half-joking, lets say. ;)
     
  18. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    The only current issue with the system is if you are looking to run it on phones you will have to look into pooling of GameObjects, while I could put in the effort to get this natively supported by the system. It is beyond the scope of this free Asset.
     
  19. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764
    If you want to provide PoolManager support, let me know. We always provide a free copy to people who integrate support.

    The example files have a very simple spawner for reference (no UI, it is a script example). A C# preprocessor directive can be used to include support so the tool works even when PoolManager is not installed. A user would just have to uncomment a single line at the top of a file and it would just work.
     
  20. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
  21. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    New version of Spawner is currently being sent to the Asset Store, this version brings with it support for Pool Manager by Path-o-Logical Games. You will have to buy a copy of it in order for it to be used, with one simple uncomment in a single file you can benefit from improved performance with regards to instantiating and destroying of GameObjects. This will improve performance on mobiles and the like.

    Version 1.5:
    • Support for Pool Manager
    • Support for adding a transform to specify where to spawn, if it is null (empty) uses the spawner GameObject
    • Small improvement to the SpawnAI component.

    With Pool Manager installed and set up, I have seen increases in time for frames by around 0.5 to 2.0 milliseconds.

    Regards,
    Garth
     
  22. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    I've started working on a CoRoutine version that will replace the current Update() method, however I seem to be running into problems with TimedWaves not adhering to their times and instead of 10 seconds (as testing) it occasionally spawns at around 6 seconds.
     
  23. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    As soon as version 1.5 has been approved on the asset store I am going to push version 1.6 to the asset store, I have improved the documentation within Docs.zip slightly and hopefully improved the performance of the Spawner by switching out Update() with a coroutine.
     
  24. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    I checked the asset store, but the v 1.1 is still there.
    And, thanks for the Pool Manager 2 support.
     
  25. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    I know, either there is a massive backlog of new assets to be reviewed by the Unity staff or there has been some weird error. Hopefully 1.6 will be available sometime this week.
     
  26. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    Version 1.6 is now live on the Asset Store, this version should bring some performance benefits and includes support for Path-o-Logical's PoolManager
     
  27. pneill

    pneill

    Joined:
    Jan 21, 2007
    Posts:
    207
    Could you provide some more details about how Spawner and Pool Manager work together?

    I uncommented the line, but wasn't sure how I should wire up my pools to spawner. Any additional details would be appreciated.
     
  28. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    It was designed as a plug and play integration, as soon as you uncomment that line it will start to use a Spawn Pool by the name of SpawnedEnemy as defined in InstanceManager by poolName. If you want to create a predefined SpawnPool just ensure it is named the SpawnedEnemy.

    I just tested the above functionality and it works as expected. You can then add a Pre-Prefab Pool Option for a Spawn Unit. I might work on some functionality for Spawner where it will automatically perform this in order to prespawn the maximum number of units. That way it will become even more of a plug and play setup.
     
  29. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    Again, many thanks for this!
     
  30. Muckel

    Muckel

    Joined:
    Mar 26, 2009
    Posts:
    471
    Superb !
    many thx for Poolmanager Support !!!
    the 2 work great together :)
    go on with it !

    thank you
     
  31. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    Its a pleasure. Better Pool Manager support coming in 1.7.

    Remember to give it a review on the Asset Store :)
     
  32. pneill

    pneill

    Joined:
    Jan 21, 2007
    Posts:
    207
    Great news to hear that you're improving the support in 1.7. One feature I would love to see is the ability have different spawners pull from different spawn pools.
     
  33. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    Would you like to be able to set an entire unique Pool Name per a spawner or would you be happy with a simple appending of the Spawner ID to the end of the preset Pool Name? Currently the preset Pool Name is SpawnedEnemy, with the second option it will become SpawnedEnemy-1 and so on.

    I'm currently making it possible for the InstanceManager to handle both cases, now its just setting up the Spawner to be able to handle those. With this however means that there will have to be changes to the SpawnAI and so forth to handle getting the new pool name associated with that unit and so forth. Unless I make a massive change to how the system "destroys" units and move all that code to the Spawner and simply pass the transform of the Unit along to the Spawner and everything happens there.

    Won't it be less efficient than simply having all the spawners using the same pool? That way they share objects and so on?

    On a side note, did some stress testing this side with 8 Spawners attempting to spawn 25 units each, because of the kill time on each unit they never really spawn 25 each. I'm getting around 100 FPS at 9-10ms a frame.

    Stress Test
     
  34. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    If I had to put more time into Spawner and release say a paid for version of it, what features would you like to see in that version or this one and how much would you be willing to pay for a high quality Spawner system?
     
  35. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    Version 1.7 is live on the asset store
     
  36. gunga

    gunga

    Joined:
    Jan 2, 2012
    Posts:
    170
    Hi,

    Thanks for this but I can't get the spawner to spawn one enemy at a time infinitely. Also i keep getting:

    Code (csharp):
    1. SendMessage SetID has no receiver!
     
  37. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    If you set it to spawn Normal and set the total number of enemies to 1 it should only spawn one enemy indefinitely until you tell it to stop spawning.

    The reason you getting the error is because you need to have a method on your Enemy that is called SetID that receives an integer. You will then need to call kill function on the spawner with that integer in order to "delete" the enemy and make it spawn again.

    There is a component that comes with the system that handles all that functionality provided that you call the Remove function on it when you destroy your Enemy.

    In order to use the component, simply add it your Enemy Prefab. Then make use of GetComponent, to get a reference to the SpawnAI on the enemy uni, in your main AI component that is on the enemy and call Remove function. This will handle interacting with the Spawner(s) and handle respawning and so forth.
     
  38. gunga

    gunga

    Joined:
    Jan 2, 2012
    Posts:
    170
    Thanks for the help. I'll look in to that.
     
  39. kheng

    kheng

    Joined:
    Oct 22, 2008
    Posts:
    126
    Thx for this! If you are looking to make a paid version of this it would be nice to have a better wave spawner. For example if I want to spawn 3 easy enemies at the same time but have it pick from 6 different locations(that I can assign). But every enemy would be at a different location, and not spawn on top of each other. Another feature that would come in handy is being able to randomly pick the amount of enemies. Say every time a wave spawns it can be between the amount X and Y.

    I would pay 15 bucks if you add these features.

    P.S. Is there an easy way to add more assign units? If not that should be a feature too. Like a button on the UI.
     
  40. Hardhitter77

    Hardhitter77

    Joined:
    Jul 17, 2012
    Posts:
    3
    I know this probably seems a little silly because it is probably super simple but I am still learning the ropes. I need a little help trying to make the spawner work. I am not sure what scripts to add to what and I don't even know if I put the gizmos folder into the right spot. (The documentation explained to put the gizmos folder into the root of the assets folder, but I am not sure how to do this.) Like I said I know it is probably very simple, but any help with this would be much appreciated. Thanks!
     
  41. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    I will write up a proper tutorial later as I'm about to go into a meeting.

    The gizmos folder isn't a necessity. However, you can simply locate it (under the spawner folder) and drag it into a clear area within the project view. That should move it to the root of the Assets folder.

    With regards to the scripts required. To setup a spawner simply add the spawner script to a game object and place it where you want the enemy to spawn from. Then to the enemy prefabs you want to spawn. Add the AI script. Then add references to the prefabs in the spawner gameobject.

    It should theoretically work correctly once that has been done. However, it has been a while since I have worked with Spawner so I might be off a tad bit with class names and so forth.

    Regards,
    Garth
     
  42. DarkDarnen

    DarkDarnen

    Joined:
    Jul 12, 2012
    Posts:
    1
    Thanks for this it saved me a lot of time!
     
  43. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    I have just pushed a pro version of Spawner to the Asset Store. This includes some core changes that allows for further expansion and features, along with influence from some requested features.

    Main Changes:
    • New custom inspector and editors
    • Multiple spawn locations per a spawner
    • Multiple units per a unit level
    • Coded to work with Unity 4.0 (namespaces)
    • Lots of coding changes to try and improve performance and lower allocations at runtime.

    I have done a tutorial to show off most of the new features of the Pro version.



    The current entry price point will be $20.

    Regards,
    Garth
     
  44. UNITY3D_TEAM

    UNITY3D_TEAM

    Joined:
    Apr 23, 2012
    Posts:
    720
    hi can i get download link for this file?
     
  45. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
  46. UNITY3D_TEAM

    UNITY3D_TEAM

    Joined:
    Apr 23, 2012
    Posts:
    720
  47. UNITY3D_TEAM

    UNITY3D_TEAM

    Joined:
    Apr 23, 2012
    Posts:
    720
    Spawner - Pro (Awaiting review):- all the best for this pro verison
     
    Last edited: Nov 22, 2012
  48. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
  49. timsk

    timsk

    Joined:
    May 27, 2011
    Posts:
    177
    Just upgraded my project to Unity 4 and spawner has stopped working.

    Unity seems to think the class name does not match the file name for Spawner.cs (When it does). Removing the pre-compiler #if that puts it into a namespace for unity 4 fixes the error and everything works fine.

    Just thought I would let you know!

    Edit: I have to remove all of the #if UNITY_4 lines in any script that has them to get it fully working. Oh, and this is Spawner Pro.
     
    Last edited: Mar 21, 2013
  50. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    Thanks for that, I will need to look into that then.