Search Unity

3D Tower Defense Starter Kit

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

  1. VietNezo

    VietNezo

    Joined:
    Feb 6, 2015
    Posts:
    2
    Hello Baroni!

    I started with your project. I built it for Windows Phone 8.1, but it runs very slowly and has some lag.
    Please tell me, what can I do to improve that?
    Thank you so much!
     
  2. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Hi VietNezo! An app's performance usually depends on the models, draw calls and device limitations. The models in this kit are also used for desktop levels and are not that well suited for mobiles. When you are integrating your own models and designing your level size, it is important to keep an eye on the draw calls and using low-poly models which batch together, using hard shadows or no shadows at all. How much geometry, enemies and effects can be handled really depends on the device.
     
  3. acmeydan

    acmeydan

    Joined:
    Jul 27, 2012
    Posts:
    15
    Hi baroni,

    My working package is the old one, from old NGUI version. I am working on it since months. Now I want to update. How can I update my project with your new version, the one without NGUI?

    And what about firing enemies in your next update?. Should I wait for next update if it will be soon?
     
  4. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Hi acmeydan, unfortunately there is no easy way to update a complete project with a different source. The Unity UI version changes at least the GUI scripts (GUIImpl.cs, GUILogic.cs) as well as the sample scenes (replacing NGUI widgets with Unity UI) and enemy prefabs (Properties.cs, healthbar object). It really depends on your changes to the old project. If you've only integrated your own world and prefabs, you could try to export them into the new version.

    The new update will raise the version number to 2.0, indicating a breaking release. Reason for this are many, such as tower laning support (a la plants vs zombies), switching from legacy to Mecanim animations, the offensive enemies mentioned (with pathfinding) and overall more modular design. This is necessary to keep going forward with the development of this kit and allowing for future additions. The update will require and arrive with the release of Unity 5. I can't give you a clear answer here, but if you really want to update in the coming months, I would do it only once.
     
  5. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Free asset giveaway!

    Starting next month, we will be giving away this or one of our other assets (http://u3d.as/2uX) to one lucky follower every month. Follow us on Twitter @Rebound_G to stay updated and don't miss the chance to win!
     
  6. pool611

    pool611

    Joined:
    Mar 4, 2015
    Posts:
    9
    Hi baroni,
    I found that if the first wave is finished, and the second wave's enimies is as the same as the first wave's , to the second wave, the enimies are all under ground , it's strange
    please have a look my upload file
     

    Attached Files:

  7. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Hey pool,
    thanks for the screenshot, that's really strange. Because in your image, two of them even have a shadow on the ground.. Could you check that your enemy prefabs are positioned at (0,0,0) and let me know?
     
  8. Gabriella Mica

    Gabriella Mica

    Joined:
    Mar 4, 2015
    Posts:
    4
    Awesome! What's the price?
     
  9. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Thanks! First page, big blue button ;)

     
  10. pool611

    pool611

    Joined:
    Mar 4, 2015
    Posts:
    9
    Hi baroni,
    sorry , I don't understand the position(0,0,0) because the my enemies begin not at position(0,0,0) is correct to fit for the ground. Please forgive my poor English.
    I upload these images. I think that when the first wave begins and no tower on the ground, enemies run to the end of road the the Position(Y) is from -1.8 to -7.9795 , then the second wave begins and the enemies begin from the Position(Y = -7.9795) , it's wrong and Position(X) is correct. At last, I found that if enemies are dead on the road by tower ,they are normal at the second wave, when enemies run off the road and die, the strange problem appears.
     

    Attached Files:

    Last edited: Mar 4, 2015
  11. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    @pool611 thanks for the additional screenshots, I've found out that this is related to the "Escape" animation moving the object down through the ground, but then it mistakenly stays there. The fix is to set the position back manually after playing the animation. In Properties.cs:

    Insert below line 31:
    Code (csharp):
    1. private Vector3 animPos; //relative animation position at the start
    Insert below line 55:
    Code (csharp):
    1. animPos = anim.transform.localPosition;
    Insert below line 411:
    Code (csharp):
    1. anim.transform.localPosition = animPos;
     
  12. pool611

    pool611

    Joined:
    Mar 4, 2015
    Posts:
    9
    @Baroni It's OK, thank you very much:D
     
  13. pool611

    pool611

    Joined:
    Mar 4, 2015
    Posts:
    9
    Hi baroni,
    I seem to have found a bug again.Please have a look at the images and the towers' name have a problem. It shows the wrong name of tower and I found that when I press the button, the method "CreateTower" in "GUIImpl.cs" execute twice, It make the wrong name of tower.
     

    Attached Files:

  14. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Hey pool, looks like the issue lies indeed with CreateTower() being fired even on unselected buttons. Maybe there's a smarter solution by using toggle groups or the like, but the following line fixes it too, added in GUIImpl.cs at line 344:

    Code (csharp):
    1.     public void CreateTower(int index)
    2.     {
    3.         Transform button = buttons.towerButtons.transform.GetChild(index);
    4.         Toggle checkbox = button.GetComponent<Toggle>();
    5.         //new additional check for ignoring deselected checkboxes
    6.         if (selectedCheckbox != null && !checkbox.isOn && selectedCheckbox != checkbox) return;
     
  15. pool611

    pool611

    Joined:
    Mar 4, 2015
    Posts:
    9
    @Baroni Thank you for your interpretation :p again
     
  16. YanlingLi

    YanlingLi

    Joined:
    Mar 16, 2015
    Posts:
    2
    Hello Baroni,
    I want to use the tower model(setting in GUIImpl.cs) in the game on android, but I can't press the tower button any more. when I press the tower button one time, the tooltip appears and disappears fast, there are no time to me to set the tower.
    If you have some tips to solve the problem, please tell me. Thank you very much~
     
  17. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Hey there, what tower model do you mean? Which kit version do you use and do you test it on the device?
     
  18. YanlingLi

    YanlingLi

    Joined:
    Mar 16, 2015
    Posts:
    2
    Hi,Baroni
    your questions:
    what tower model do you mean?
    I use every tower and the problem appears. I think It's nothing to do with the towers.

    Which kit version do you use?
    3DTDSK1.7

    do you test it on the device?
    I build the project to APK and run on the android device.

    What's more,I found the way to solve the problem,just like the image.
    I think the main reason is about UI penetrate,in the simulator there is no problem,but in the Android device , it may be respond twice with one click.tower model(mobile).png show the game with problems on android device and solve.png shows how to slove them.
     

    Attached Files:

  19. NoEscape0

    NoEscape0

    Joined:
    Sep 29, 2012
    Posts:
    16
    Hello.
    Could you please tell me how you've solved problem with making the package with saving all tags? When I create a package that is based on this kit most of my tags disappear eventually.
     
  20. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Hi, tags and layers are defined in the project settings. When uploaded to the Asset Store, these are included automatically for complete projects. If you would like to export your own package with the project settings included, create a short script and make use of the ExportPackageOptions.
     
  21. VietNezo

    VietNezo

    Joined:
    Feb 6, 2015
    Posts:
    2
    Hello Baroni! It 's me again.

    I started to create new terrain like level_mobile but I don't know how to draw the shadow of trees or walls. Could you tell me how to do this.
    Thank you so much!
     
  22. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Hey there, they aren't drawn, but baked by using the lightmapping panel.
     
    Last edited: May 12, 2015
  23. gevarre

    gevarre

    Joined:
    Jan 19, 2009
    Posts:
    132
    Hi, love the starter kit. I bought it a long time ago and have been following it ever since. Now that I'm ready to use it on a serious project, I have a request:

    In the game I'm doing, I need an enemy wave to be able to choose randomly between multiple paths: not each enemy choosing a different path, just the entire wave chooses one path out of a list and then follows it. This is necessary so that the player never knows which path the enemy will follow and so that gameplay is different each time it's played.

    Would it be possible to make it so that in the wave manager, multiple paths can be assigned to the same enemy and then have one randomly picked at runtime?
     
  24. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Hi gevarre,

    the WaveManager exposes wave properties in its public "options" variable. There is a list entry for every enemy, including the path. You could write a short script that accesses the wave options and sets a random path for the whole wave at runtime, e.g. in a Start() method. That wouldn't be too complicated and as far as I can see, does not require modifying existing code.
     
  25. jayantjain

    jayantjain

    Joined:
    Sep 24, 2012
    Posts:
    1
    I had experimented a little with this kit earlier, and it is fantastic! I just had one question:

    I recently started a new project with the kit, and I want to try and make a mobile game with it. When I run the mobile scene however, I am unable to place towers in the default mobile scene, as I used to be able to do earlier. The desktop scene works fine. It's just the mobile one that doesn't let me place towers when I click on the grids.

    I've been getting this debug message whenever I open the mobile scene in the editor. It showes up 6 times:


    Tried to create tower on BuildMode Grid, without selecting a grid. This won't work, aborting. Design your GUI to select a grid first (see the mobile scene)!
    UnityEngine.Debug:LogWarning(Object)
    GUIImpl:CreateTower(Int32) (at Assets/3D Tower Defense Starter Kit/Scripts/GUI/GUIImpl.cs:347)
    UnityEngine.Canvas:SendWillRenderCanvases()


    In addition, on the mobile scene, the minimap with enemy progress does not show any enemy sprites.

    Could you please help me fix this? Thanks!
     
  26. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    The mobile scene makes use of Unity's touch input calls and is not meant to be run on non-mobile devices. You can use Unity Remote to play-test it directly and skipping deployment.

    The warnings are showing up because the tower buttons are set to "execute in editor + runtime". They are harmless, but if you want to get rid of them, select each tower button, scroll down to their events section and select at runtime only.

    I'm not sure why that would happen (they do show up for me correctly). Could you verify that on the enemy's TweenMove script, the progress map properties are filled out?
     
  27. Defero

    Defero

    Joined:
    Jul 9, 2012
    Posts:
    200
    Hi,

    i love the plugin, just finished setting up the first level. I don't know if it's been asked yet, but there is one thing that bothers me a bit, but it has nothing to do with your plugin.
    When you're using the joystick (mobile) anything that is behind the joystick (a tower ie) also reads the tuch input, and shows the tower selection menu.

    Is there a way to ignore the touches, if the ugui elements are in the front?

    Regards,
    Defero
     
  28. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Hi Defero,
    Unity has a quick check for that: EventSystem.current.IsPointerOverGameObject(). This is integrated in the Update method of the GUIImpl script (GUI implementation) already, but is has one drawback - on mobiles, IsPointerOverGameObject is always null, meaning it doesn't work there.

    For buttons I implemented a workaround by passing in the id of your finger, which is also being done in the Update method of GUIImpl: EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId). However for real gameobjects (grids, towers), you would actually have to detect whether the joystick is moving/released and block any raycasts in this case. This isn't included yet as far as I know, but would go into the Update method of GUIImpl.cs too if you want to try it out.
     
  29. Defero

    Defero

    Joined:
    Jul 9, 2012
    Posts:
    200
    Hi,

    thank you for the quick reply. Ok, try flagging the joystick when it's in use.

    One more question. What would be the fastest way to make the Power-ups global. Meaning, that i would have only one power-ups menu, and it would apply to all levels in the game.
    And probably i'll have to make my own gui for this because it's for mobile?

    Edit:
    Would making the Power-up manager as a prefab, and loading it at the start work? Or would this conflict with the execution order of things?


    Regards,
    Defero
     
    Last edited: Jul 10, 2015
  30. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Hi, that would work. Just reference the "new" powerup manager in the GUI script after dragging it into the scene.

    You could either make some prefabs out of the powerup buttons too (or out of the powerup manager and the buttons, so that they don't lose their reference to each other), or create your own gui, of course.
     
  31. filus1025

    filus1025

    Joined:
    Jul 3, 2015
    Posts:
    2
    Hello I have a problem with projectile "bullet" it's working properly on your built in cannon tower, but when I have built my own version of cannon tower the projectile "bullet" during the game is causing this error.

    "
    KeyNotFoundException: The given key was not present in the dictionary.
    System.Collections.Generic.Dictionary`2[System.String,Properties].get_Item (System.String key) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150)
    Projectile.Explosion () (at Assets/3D Tower Defense Starter Kit/Scripts/Projectile/Projectile.cs:347)
    UnityEngine.MonoBehaviour:StartCoroutine(String)
    <HandleImpact>c__Iterator26:MoveNext() (at Assets/3D Tower Defense Starter Kit/Scripts/Projectile/Projectile.cs:299)
    UnityEngine.MonoBehaviour:StartCoroutine(String)
    <OnTriggerEnter>c__Iterator25:MoveNext() (at Assets/3D Tower Defense Starter Kit/Scripts/Projectile/Projectile.cs:284)"

    I can't figure out where is the problem. My Cannon tower has the same configuration as yours and I have already built a few towers like yours all them work properly except that one that uses the bullet projectile. I will be glad if you could answer me.
     
  32. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Hi filus, thanks for posting that error. I can't see that it's something related to towers.

    In line 347 of Projectile.cs, the projectile tries to access your enemy's Properties script (health). On this step, the error is thrown because the projectile can't find the Properties script for the object it collided with. Please check that:
    - only enemies have the "Enemy" layer assigned to them
    - enemy objects only have one collider, on the main/root object
    - the Properties script is attached besides the collider (same object)
    - your projectile must be on the "Projectile" layer (I think)
     
  33. filus1025

    filus1025

    Joined:
    Jul 3, 2015
    Posts:
    2
    Hello, thanks for your reply. The fact is that the only things I have changed already are the towers :/
    I did not changed the Enemies same for projectile, I am using the version from your assets.
    Could there be something another?

    edit the problem shows up only when Explosion check box is checked.
     
  34. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    @filus1025 Could you send me the tower + projectile prefabs (or full project) to my email (last page in documentation pdf)? Some screenshots or other relevant data would be good too.
     
  35. HeraticGalaxy

    HeraticGalaxy

    Joined:
    Aug 23, 2014
    Posts:
    31
    It's ok thanks, I worked it out :) It seems you get this error if you have 0 upgrades or don't attach the upgrade script. Once I added the upgrades it all worked ok so far... now just have to work out the turret rotation and it's good to go.

    Thanks for the quick reply!

    Dean
     
  36. HeraticGalaxy

    HeraticGalaxy

    Joined:
    Aug 23, 2014
    Posts:
    31
    Hi Baroni,

    Trying to work something out with a projectile. I have my own added to my own tower, the tower has a turret on it. The turret rotates and follows the first enemy, the projectile shoots and all looks fine, where the problem is however is that the turret keeps following the first enemy but the projectile is shooting at the nearest enemy. The turret shoot order is set to First In.

    This is my tower
    upload_2015-8-10_22-38-27.png

    And this is my projectile:
    upload_2015-8-10_22-39-8.png

    Can you let me know what I might be doing wrong?

    Thanks
    Dean
     
  37. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Hi Dean,
    thanks for the screenshots but I can't tell why this would happen. Your setup looks fine. Is the range value on your upgrade script large enough to encapsulate all enemies and the turret has a default rotation of (0,0,0)?
     
  38. HeraticGalaxy

    HeraticGalaxy

    Joined:
    Aug 23, 2014
    Posts:
    31
    Hi Baroni,

    The default rotation is 0,0,0 and I think the upgrade values are right, here's the upgrade script:

    upload_2015-8-11_4-49-44.png

    Can I email you my prefab to take a look?

    Regards,
    Dean
     
  39. johnenrico

    johnenrico

    Joined:
    Aug 25, 2015
    Posts:
    2
    oh no some layers and tags are missing,.can you please send me list of tags and layers need in the game so that function will run smoothly :) t.y.
     
  40. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    @HeraticGalaxy Hi, please remove your prefab in the first "Swap Model" slot too. Also you can send me the model+prefab, of course.

    @johnenrico
    You can reimport only the package's project settings, but it will also overwrite your existing layers & tags.

    Layers&Tags.png
     
  41. acmeydan

    acmeydan

    Joined:
    Jul 27, 2012
    Posts:
    15
    Hi Baroni;

    I want to make an indicator UI for coming enemies(how many enemies are coming from where). I find this data stored in wavemanager.cs. I see it inside; options[waveIndex].enemyPrefab[index], but i couldnt figure it out how to access this before wave start. Or should I use waveEditor? Can you recommend me a way? Thank you.
     
  42. acmeydan

    acmeydan

    Joined:
    Jul 27, 2012
    Posts:
    15
    Ok. I found it bymyself. For those who interested the script is like that;


    Code (CSharp):
    1. WaveIndicator.waveIndex = GameHandler.wave;
    2.        enemylist = "";
    3.  
    4.         for (int i = 0; i < w1.options[waveIndex].enemyPrefab.Count; i++)
    5.         {
    6.             enemylist += w1.options[waveIndex].enemyPrefab[i].name + "x" + w1.options[waveIndex].enemyCount[i] + "\n";
    7.         }
    8.  
    9.  
    10.  
    11.        enemyname.text = enemylist;
    12.  
     
  43. mahdijj

    mahdijj

    Joined:
    Sep 24, 2015
    Posts:
    31
    hi
    this project support in app purchases in android?
    making an android app with this is easy?
     
  44. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    There are no in app purchases built in, but you could do that yourself using OpenIAB or our Simple IAP System asset.
     
  45. johnenrico

    johnenrico

    Joined:
    Aug 25, 2015
    Posts:
    2
    Hi Developer,.im using mobile version of your work how can i remove the zoom in and zoom out functions,.
    i just want to maintain the y value so that it will not zoom in or zoom out.
    tnx
     
  46. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Hi @johnenrico, the mobile scene does not really have a zoom in/out function. While moving the camera via touch joysticks, the camera only slightly moves up or down. That can be controlled in the UIJoystick.cs script directly. If you mean zooming into a tower (and control it), then that's a different thing.
     
  47. acarterczyz

    acarterczyz

    Joined:
    Dec 24, 2015
    Posts:
    8
    I am running in to an issue. The game is very dark. I don't think I messed with anything other than updating Unity. How do I fix this? Thanks!


    EDIT: Fixed this. Somehow the ambient light was set to black haha
     
    Last edited: Feb 27, 2016
  48. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    When I saw your Tutorial Designer on the asset store I instantly thought how cool it would be to have a next version of your 3D Tower Defense asset released with a nodal interface, where you can build different towers and creeps, missions, upgrades. Am I wrong?
     
  49. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    @Mark_T not sure what you are looking for; Tutorial Designer is specifically meant for building missions / tutorials / dialog workflows. Regarding the other things such as towers, creeps, upgrades, you have inspector tools and editor windows in this asset so this can be adjusted without coding already!? Am I missing something?
     
  50. Kaemalux

    Kaemalux

    Joined:
    Aug 1, 2013
    Posts:
    45
    Hello!
    Is this asset development still active? I really like the product and i would like to know if there are any upcoming updates planned. ^^
    Have a nice day!

    Cheers,
    Kaem