Search Unity

3D Tower Defense Starter Kit

Discussion in 'Assets and Asset Store' started by Baroni, Mar 30, 2012.

  1. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Hi galent,

    the Properties script, attached to the enemy prefabs, adds itself to the PoolManager.Props dictionary in Start() once the prefab spawns. When the enemy object walks near a tower, the RangeTrigger script then accesses the Properties script and adds it to the tower. There is no additional setup step needed for playing the sample scenes. Where does the error come from, at what step? Do you have own enemy prefabs or are you just playing the demo scenes (Unity version?)

    Greetings,
    B.
     
  2. Lioncirth

    Lioncirth

    Joined:
    Apr 7, 2009
    Posts:
    111
    Hi Baroni

    I am just trying to mess around with the upgrade and I dont know if I am doing it correctly.

    Basically I have 6 towers set up, lets call them T1 all the way to T6.

    I have set up all of the base scripts etc and under upgrades I have done the following;

    T1 - 2 upgrades set;

    Upgrade 1: sets the initial cost and skills of the Tower
    Upgrade 2: Sets the next skills but under Swap Model, I put in T2 Prefab.

    T2 has two upgrades

    Upgrade1: The stats from Upgrade 2 on T1
    Upgrade 2: Stronger stats I then add in the T3 Prefab

    and so on.

    It seems to be working until I get to T6 and I get the error message

    "ArgunmentOutOfRangeException: Argument is out of range. Parameter name: Index

    I am not sure if I am setting the upgrades properly.

    basically I am trying to get it to upgrade to a new colour of tower with each upgrade purchased.

    Thanks
     
  3. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Hey,

    the new models of the tower (T2 - T6) don't need the Upgrade script. You only set up the Upgrade script on your original tower (T1) once, then the stats etc. will be ported to the new models. (see the arrow tower and the upgraded arrow tower prefab for reference) I mentioned this somewhere in the documentation... could it be that thats the problem?
     
  4. galent

    galent

    Joined:
    Jan 7, 2008
    Posts:
    1,078
    Hey Baroni,

    Yeah, I did a search and found the add. I located the missing config. The error occurred when ever an enemy hit the range collider/trigger. No I wasn't using one of your enemy assets, I had baked my own.

    Great kit btw!

    Thanks,

    Galen
     
  5. Lioncirth

    Lioncirth

    Joined:
    Apr 7, 2009
    Posts:
    111
    Ah works perfect, Thanks again! :)

    Do you have a list of planned features that your thinking of adding into the kit?

    I am looking to do it so that the enemies attack the towers - but if this is going to be added into the kit at a later date, I might hold off doing it :)

    Thanks
     
    Last edited: Mar 5, 2013
  6. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Great :)

    For the next update I'm thinking of adding more tower mechanics, as the upgrade system introduced in the current version worked out really well and I'm happy to see it in action. Can't tell any further details yet.

    Assaulting enemies are indeed on the list, but I have no estimated date for this feature. My progress depends on a Unity feature what is yet to come and will likely require Unity Pro. In this context, I'll implement an additional movement system (hint hint), therefore there's a lot of work to do. So, don't hold off!
     
  7. Lioncirth

    Lioncirth

    Joined:
    Apr 7, 2009
    Posts:
    111
    Sounds Great!

    I really love the kit and its helped me so much, looking forward to more :)
     
  8. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    Still enjoying the kit. Only problem I've run into now is that when I made my own enemy everything works as it should except his animations only loop once then quit.

    Could ya give me a hand on what I'm doing wrong.

    I also want to make it so the towers don't become player controlled for targeting upon right click and whatnot, is there any way you could make the script have the option to toggle it in the inspector?
     
  9. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    1. Not directly related to the kit: http://answers.unity3d.com/questions/202766/how-to-play-an-animation-in-a-loop.html

    2. The GUIImpl.cs is responsible for attaching the SelfControl script to the towers. Search for ProcessTower() within GUIImpl, then simply remove the last check that contains "EnableSelfControl()" :) Of course you could also insert another public boolean variable to the check.
     
  10. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    Excellent, great support as always.:)
     
  11. L0FFY

    L0FFY

    Joined:
    Mar 15, 2013
    Posts:
    3
    The PDF, page 24: "This Starter Kit uses the distribution version of NGUI. If you own NGUI, the first thing you likely want to do is to get rid of its watermark. To do that, simply open a new scene, delete the NGUI folder of this kit and import your full version."

    While in Unity and in 3D Tower Defense Starter Kit, I clicked "create new scene". Then I deleted the NGUI folder in Unity and in 3D Tower Defense Starter Kit. Then what? What does import your full version mean here? I will try and fix this myself but any input is appreciated. Just point me in the right direction.
     
  12. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    It means that, since this kit uses the free version of NGUI and NGUI is a paid asset (currently $95), you will have to buy NGUI in order to remove the watermark. On the first page of this thread and in the description of the kit I wrote:

    Important when importing NGUI version 2.3.6+

    As it fits here, a few hours ago someone noticed a problem when importing the full version of NGUI. Version 2.3.6 of NGUI introduced a change to one of its components, UISlider, throwing an error as a result. I wasn't aware that the author of NGUI removed a property in its latest version.

    Here's how to fix this error:

    Please remove line 48 and 49 in ProgressMap.cs and type in this size setting for the progress map object prefabs

    "pMapObjGround" and "pMapObjAir"

    See the screenshot!
     
  13. 3

    3

    Joined:
    Sep 16, 2012
    Posts:
    387
    This looks fantastic, I was thinking about making a tower defense game and I'm considering this to get me started.
     
  14. bravery

    bravery

    Joined:
    Mar 26, 2009
    Posts:
    270
    Hi Baroni,

    I was wondering if there is a way to make the generation of the enemies dynamic, so instead of setting all the numbers manually as in-order to be able to check wither the numbers you select for the enemies / tower projectiles ... etc, will not make the game so easy or even so diffuclt, this will take a long time of testing for every single level you build.

    So I was wondering if there is any kind of dyanmic diffculitey adjustment, where the system will calculate the whatever towers you have and there power, and take in consideration the route the enemies will use and based on that dynamically set the number of enemies in every wave and the diffculites (hitpoint) for every enemy in the wave.

    I understand that this is not something easy to do but if we manage to do it, the desing of the tower-defense game will be a lot easier.

    Thanks in adance.
     
  15. Acolit

    Acolit

    Joined:
    Aug 13, 2012
    Posts:
    51
    Can i build the kit for a flash? like your demo?
     
  16. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    @3
    Thank you!

    @bravery
    That would be a lot of work indeed, feels like a complete auto-setup configuration with AI for calculating the difficulty settings... Also, the setting should access all tower prefabs, projectiles and enemies, uuuh... I can't see this happen anytime soon, but I understand your concern when playtesting different levels. Will keep this in mind.

    @Acolit
    Flash? Flash is a separate platform plugin sold by Unity, my demo uses the default Unity webplayer. Unfortunately I don't know whether the scenes will work when exporting to Flash, I think no one tested it out yet.
     
  17. Xete

    Xete

    Joined:
    Oct 17, 2012
    Posts:
    9
    Hi Baroni, i was wondering if buying this kit means i gotta purchase the Simple Waypoint System as well? it was free till april but it was last year so im guessing the offer doesn't apply anymore does it?
     
  18. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Hi Xete,

    you don't need to buy SWS in order to use this kit. The kit has a stripped down version of SWS implemented that is ready to use. It's modified to fit into the kit, though. So if you want to use a waypoint system in other or more general context, I recommend buying SWS. The 'get it free' offer was a one-time promotional thingy due to the introduction of our tower defense kit.
     
  19. Xete

    Xete

    Joined:
    Oct 17, 2012
    Posts:
    9
    Hello again Baroni, im glad to hear that and i understand, thank you for making it clear :) .
     
  20. WereCrab

    WereCrab

    Joined:
    Mar 26, 2013
    Posts:
    4
    Hi Baroni!

    Great KIT, thanks a lot :)

    I want to create a script which allows monster waves to select the most safe path. So I want to ask: when user builds a tower is there any method to determine which paths are covered by this tower?
     
    Last edited: Mar 27, 2013
  21. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Hi WereCrab,

    thanks! Hmm one way would be to separate your map into segments and rename the grids in this segment with a unique letter. E.g. all grids intercepting with path1 are named "grid1_one", "grid2_one" and so on. As a result you could check the grid array and count these letters, in order to know how many towers were built per path - then determine the path with a small amount of towers.

    Hope this helps!

    Regards,
    B.
     
  22. WereCrab

    WereCrab

    Joined:
    Mar 26, 2013
    Posts:
    4
    Thanks for quick reply.

    I think about the similar way: split the paths to the line segments, then verify whether the segment intersects the tower range circle (I do this verification for each segment, number of segments is less than number of grid cells).

    Thus I can handle cases when the tower covers more then one path and the enemy have to chose which one is less covered.
     
    Last edited: Mar 27, 2013
  23. KeysMaster

    KeysMaster

    Joined:
    Apr 6, 2013
    Posts:
    1
    I'm trying to figure out something that I just can't...
    Let's say I don't have enough resources to upgrade, but my upgrade window is open with the upgrade button not showing.
    How can I make it, that when I have enough resources, the upgrade button appears automatically, without having to close the tooltip / upgrade window and re-opening again.
    I tried calling the function when the enemy dies, but I failed... dunno how to do it.
    Can anyone help?
    Thanks.
     
  24. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Hi KeysMaster,

    I don't know what you've tried already, so let me explain the scripts and methods involved for this change:

    * The method "ShowUpgradeMenu ( GameObject tower )" in GUIImpl.cs is responsible for showing the upgrade menu for a specific tower, but also for updating it if it's already active, in this case SV.showUpgrade equals true.
    * GUILogic.cs holds information about towers, such as their important components.
    * Within GameHandler.cs, there is a method named "SetResources ( int index, float points )", that adds resources to the player when an enemy has been defeated.

    Ultimately, you could call GUIImpl.ShowUpgradeMenu ( GameObject tower ) from within SetResources(...), if the upgrade menu was opened. You'll need the tower gameobject as an argument for ShowUpgradeMenu(...). Since the upgrade menu is already shown, GUILogic.cs holds all necessary components and you can use the tower object of its upgrade component, resulting in the following code:

    Code (csharp):
    1. if (SV.showUpgrade == true)
    2.     GUIImpl.ShowUpgradeMenu ( GUILogic.upgrade.gameObject );
    Note: This is pseudocode, you'll have to set references to GUIImpl and GUILogic to be callable, as well as play a bit with the code - SetResources(...) is a static method, but ShowUpgradeMenu(...) is not.
     
  25. Simotti

    Simotti

    Joined:
    Apr 21, 2013
    Posts:
    4
    Hello, how do you create new level on this kit? I am total noob and i have no idea about anything. Does it use the NGUI? If it does, can you point me how to create level on ngui?

    Thanks alot
     
  26. GinForce

    GinForce

    Joined:
    Apr 21, 2013
    Posts:
    1
    Pay homage to the creator of 3D Tower Defense Starter Kit.
    Here I get stuck in a basic step-----I wanna play the demo of the "Level_Desktop",but I can't build any tower in it.......
    Is "Level_Desktop" just an overview? Or is there anything wrong with my Unity........
     
  27. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Hey Simotti,

    you can build a new level based on the existing scenes. If you want to create a mobile game, I recommend using the scene "Level_Mobile" as a starting point. Otherwise, use "Level_Desktop". Please read the documentation before modifying the kit, so you get an overview of the components you will use. After reading the documentation, duplicate one of the scenes and try to alter the terrain, grids, waypoints, waves and so on. NGUI is just a plugin for the user interface.

    Hi GinForce,

    please read the readme included in this kit, then please refer to the documentation, page 3. Both documents state that you have to import a file containing project settings before playing the game. The game even throws an error if you try to play it, without setting up your project settings first.

    Regards
     
  28. Simotti

    Simotti

    Joined:
    Apr 21, 2013
    Posts:
    4
    Thank you for answering. I know how grids, waypoints, waves and tower managers but i have problems with duplicating the scene. As i duplicate it lets say "Level_Mobile_1" and change the "Terrain" it will affect the "Level_Mobile" too. I know that you answered to this one with a link, but i didnt understand how that should help.

    Thank you.
     
  29. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
  30. Windfeld1980

    Windfeld1980

    Joined:
    Apr 28, 2013
    Posts:
    5
    Hi Baroni! I'm a new owner of your awesome kit - thanks for the hard work!

    I am playing around and wanted to have a tower made of a skinned mesh - I can't seem to figure out why it won't work. It just spawns the "skinned mesh" at 0,0,0 and I can't even move it while running. Is skinned meshes supported for towers at all?

    Thanks for your time,
    /W
     
  31. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Hi Windfeld,

    thank you for your purchase, I'm glad you're enjoying the kit.

    Most likely your animation repositions the tower back to (0,0,0). The solution is to parent your model to another gameobject, so it stays at (0,0,0) relatively to this gameobject. See a similar question here:

    http://answers.unity3d.com/questions/262784/positioned-blender-models-with-animation-snap-back.html
    http://answers.unity3d.com/questions/40005/animated-object-changes-position-when-animation-is.html

    Regards
     
  32. Windfeld1980

    Windfeld1980

    Joined:
    Apr 28, 2013
    Posts:
    5
    Ah thanks! I had the wrong root object! For next time I'll avoid using the Tower generator when I want stuff like that :p

    Thanks again for your quick reply,
    W
     
  33. tylersavery

    tylersavery

    Joined:
    Apr 29, 2013
    Posts:
    5
    Hey Everyone - I just purchased this and I'm having a bit of trouble getting rid of a few errors. I'm using unity 4 on a mac. I've replaced the project settings with the ones in the zip file AND i've replaced the assets with the unity4 versions. The only errors remaining are ones like this (about 8 similar)

    "The type of namespspace name "TweenMove" could not be found. Are you missing a using directive or assembly reference?"

    The other ones are the same except replace "TweenMove" with "WaveManager", "Upgrade", etc...

    Seems to me some scripts aren't being included properly. Any advice will help greatly! Thanks :)
     
  34. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Hi tylersavery,

    thank you very much for your purchase and welcome to the forums :)

    Right, seems like the TweenMove.cs script could not be found in your project. Could you please double check whether it's actually there? Maybe the import missed that file, if that's the case please import it again.
     
    Last edited: Apr 29, 2013
  35. tylersavery

    tylersavery

    Joined:
    Apr 29, 2013
    Posts:
    5
    Could it possibly be called TweenPosition (instead of TweenMove) ? I'm still using the included version of NGUI...
     
  36. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    No, TweenMove.cs is one of my scripts, which is responsible for moving the enemies on the paths. TweenMove has nothing in common with NGUI's TweenPosition.
     
  37. tylersavery

    tylersavery

    Joined:
    Apr 29, 2013
    Posts:
    5
    Okay. Can't find that script anywhere. Re-downloading and going to start from scratch. I'll let you know if that file is still missing afterwards.

    Thanks,

    -Tyler
     
  38. tylersavery

    tylersavery

    Joined:
    Apr 29, 2013
    Posts:
    5
    Ok - the file is now there after the import. Going to replace the files I need to and then hopefully all will be good :) Thanks again!
     
  39. tylersavery

    tylersavery

    Joined:
    Apr 29, 2013
    Posts:
    5
    Ok all is good. Something must have gone wrong with the import - or when I was replacing the unity 4 files. Cheers
     
  40. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Thanks for letting me know, have fun and good luck with your project :)
     
  41. Mr.Supriono

    Mr.Supriono

    Joined:
    May 2, 2013
    Posts:
    1
    Hi Baroni! can I use your tower defense kit for android with unity 3.5 ??
     
  42. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Hi Supriono,

    yes ! It is compatible with Unity 3, 4 and Android, iOS.
     
  43. Goofy420

    Goofy420

    Joined:
    Apr 27, 2013
    Posts:
    248
    Is there an update coming for the high price we paid? For starters, the "3D" health bars don't always rotate towards the camera, animations will stop after the enemy touches the portal and importing into Unity 4.1.2 throws objects all around the screen and even after unpacking the unity4 files, theres too many warnings about obsolete identifiers (meaning not updated for Unity 4). Works great on 3.6 but I'm not swapping versions of Unity for assets I paid for.
    This is why I won't buy Assets anymore. No trial, no discounts, and plenty of errors on 80% of the assets I've bought.
     
    Last edited: May 12, 2013
  44. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Honestly I don't know how to react to your statement. A high price? I worked over a year on this asset, if you recalculate it, the price equals two man-hours, this is with all the models and scripts. But to answer your question - yes, I update the kit with hotfixes and other stuff when needed. I want to include more advanced features, but they rely on Unity features that are not released yet.

    I can't investigate issues that you've reported without screens or a more detailed description. I've never heard of these issues (health bar doesn't always? face the camera, animations stop at the end). Same with the obsolete identifiers. I've updated it for Unity 4.1. As you can see, I reply to every message in a timely manner.

    Therefore I won't discuss your last paragraph.
     
  45. Goofy420

    Goofy420

    Joined:
    Apr 27, 2013
    Posts:
    248
    It took me two hours to find the problem, but I won't discuss it....

    after using it a bit more, the kit is quite advanced compared to what else is available, but to those who don't get Obama Cheese, that's a "high price" to learn Unity.

    Anyways, the self control script doesn't work either and I don't have time to try anymore, so I foresee this becoming a pain. All the tutorial says about it is that it's automatically called when its attached, so...? You don't mind if I get a refund do you?


    p.s I've spent most of my life releasing free software , so intrinsic time has no meaning to me.
     
  46. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    I can't help you if you don't want to tell me what's wrong. The kit isn't meant to teach you Unity.

    The self-control script works on my pc and on xxx other devices, do as you think best.
     
  47. Goofy420

    Goofy420

    Joined:
    Apr 27, 2013
    Posts:
    248
    Here's what happened.

    1. Two weeks ago, I got the kit from the asset store and added it to a new project, but it threw errors and I was too busy to mess with it.
    2. Last night I opened the project and Unity upgraded it automagically.
    3. This morning all the objects were all over the screen, so I reimported the same package and got the obsolete warnings.
    4. This afternoon I changed all the SetActiveRecursively() to SetActive() (from NGUI) and opened the desktop scene (I was using the mobile at first). The objects were now back in place and the warnings were gone.
    5. A few hours ago, I tried adding a new enemy, but the Animation would play until the enemy reached the first portal (by the Castle bridge) and the health bars weren't facing the camera.
    6. A couple of hours ago, I went through all the variables and saw that the animation and healthbar vars were being added from the peasant prefab, I thought this to be a bug.
    7. A while ago, I reimported the package installer from the asset store and all the problems went away except self control (I don't know how to use it) and now my custom models are really really tall, and really really skinny but I think I just need to add them to the manager again maybe.

    Maybe I was too harsh at first, but I've spent over $400.00 on assets, and so far, you're the second developer who was actually a developer; not to mention answer questions. So, to sum up, all this was due to a bad package two weeks ago, or I had an old version... my bad.

    p.s. It may not be intended as a tutorial, but it works for me.
     
    Last edited: May 13, 2013
  48. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Thank you for the explanation, makes things a little bit more clear.

    Sometimes Unity destroys the scene completely when importing assets or even misses to import some scripts, I think you ran in one of these problems here.

    The obsolete messages come from the free version of NGUI. I am not allowed to fix these myself, that's why I added an additional note in the readme file. With (the latest) paid version of NGUI you should not see any warnings.

    Maybe the fbx import scale or transform scale of the model wasn't adjusted properly. If you set up your tower model just like the ones I've provided (see a prefab for reference, e.g. the ArrowTower - important details are hierarchy, colliders, layers) the GUI will detect if you right click on a tower in the scene. It will then attach the self control script to the tower, thus you can control the tower. It's 2 am here and I need to get some sleep, but I will answer your questions shortly in case you need more details on how to set up your towers.
     
  49. Goofy420

    Goofy420

    Joined:
    Apr 27, 2013
    Posts:
    248
    I just wanted to update my feelings regarding this pack.

    After scouring it long enough to see what all it's capabilities are, I can honestly say without a doubt, that this is the most complete, thought out, optimized starter out there.
    Not only is this truly drag/drop point/click (all variables can be edited from within the editor), but I have never seen such nicely formatted and optimized C# for mobile devices.

    My problems were due to a bad Unity installation, and unfortunately I immediately dropped it on the starter pack, which was completely inaccurate.
    Great pack, excellent programming, beautiful models (although I'm replacing with my own), and top notch support from the brothers.

    Thank you for dealing with me while I figured it out.


    Edit: For those who bought the full version of NGUI, you might notice Unity 4.1 CTD when switching platforms, how annoying. This is a known bug with NGUI, but to solve it, start a new scene and switch platforms from within that scene and all is well.
     
    Last edited: May 13, 2013
  50. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Huge thanks for the very positive review, I am glad you changed your mind :) It really means a lot to us to know that we're doing it right!

    Thanks for the quick tip on the NGUI bug too!