Search Unity

TowerDefense ToolKit 4

Discussion in 'Assets and Asset Store' started by songtan, Apr 18, 2012.

  1. carliunity

    carliunity

    Joined:
    Aug 3, 2013
    Posts:
    6
    Update. It is only happening in the editor. If I build and then run, it works as it should. I'm only testing the example scenes.
     
  2. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    Are you using the latest version? I'm aware of such problem but I think I've got it fix as of the last update. I just try it a dozen time on my example scenes and every thing seems to be working well.
     
  3. TensonHanzo

    TensonHanzo

    Joined:
    Sep 16, 2012
    Posts:
    13
    Really cool toolkit, thanks for all the hard work!
    I'm running into a little speed bump. I, for the life of me, can't get my turret to function properly. I have some custom prefabs implemented (also using the provided example prefabs), but I can't seem to get the turret to aim directly at a creep. It fires at the creeps and can kill them, but visually it wont look as if it's aiming directly at the creeps target point. The turrets "turret object" will rotate to aim at the creep, but the "barrel object" wont aim vertically as would be expected, for example, towards a flying creep. It just shoots upward at a weird angle. I've tried projectiles and Beam type ShootingObjects and tinkered with the various settings all day long. I've viewed the tutorials and read the manual, this has me stumped. Any advice to point me in the right direction?
    Thanks,
    Tens
     
  4. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    Thanks for the compliment.

    It's kind of hard to tell what is wrong without looking at the movement of your turret. I cant tell if it's offseted to the target or the rotation is not working at all in certain axis. I would check this first: If you want your turret to track the target in every direction, make sure you have the tower's TurretAnimateMode set to Full. You might want to make sure the AimTolerance value is relatively low, like 10. Finally, make sure your barrel aim toward positive z-axis when the turretObject rotation is at (0, 0, 0). Also if have a separate barrel arragement (where the turret base rotate around y-axis and the barrel around x-axis), you will have to assign the barrel object in the TurretObject component on the TurretObject gameObject (where the shootPoint of the turret is assigned).
     
  5. TensonHanzo

    TensonHanzo

    Joined:
    Sep 16, 2012
    Posts:
    13
    Thanks for the quick reply! After toying around with it a bit, sadly still no luck. I'm sure I'm simply overlooking something or I jumbled up the child-transform order somehow. I tried to mimic your example prefabs but it seems the one I'm using as a reference shares the same problem I experiencing with my own custom prefabs. Using the scene examples after a fresh new project/import/etc. I tested the example scene with all example prefabs you provided. I set the 1st wave to spawn your flying Drone creeps. Using the MGTower, it shoots at the Drones but its barrel doesn't visually aim at the creeps when it fires at them. However, the muzzle flare effect does point in the creeps direction, just not the barrel.
     
  6. carliunity

    carliunity

    Joined:
    Aug 3, 2013
    Posts:
    6
    I'm using v.2.2.3. It only happens if you play the game inside the editor.

    $Test1.png $Test3.png
     
  7. TensonHanzo

    TensonHanzo

    Joined:
    Sep 16, 2012
    Posts:
    13
    Unfortunately after running a build on pc and iOS I get the same outcome. I'm using v2.2.3f1. Perhaps this is just the behavior of the MGTower?
     
  8. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    @Tenson, I ran a quick test in my own project using the default example, now I see your problem. I assure you that is not the intended behaviour. It used to work, I must have broke it at some point. Anyway it has been fixed. Please send me an email so I can send you the fix. Once you got a correct working script. We can go on from there to make your tower work. I'm so sorry for the problem by the way. In such event in the future, please try with the default example and let me know if the example is working correctly or not. That way I cant identify immediately if it's a bug or just some missing setting.


    @carliunity, looks like you have some error in the log. So that could be one of the reason why it's not working properly. Can you show me what they are, starting from the very first error if possible. Also, just to be safe, try remove all the collider component of all the child transform in the platform.
     
  9. TensonHanzo

    TensonHanzo

    Joined:
    Sep 16, 2012
    Posts:
    13
    @Songtan, That's good to hear. Appreciate you looking into that. I sent you an email.
     
  10. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    Fix sent, please check your mail.

    Anyone who is currently having problem with the turret aiming, please let me know or email me if you want an advance before the next update. Sorry for the trouble.
     
  11. carliunity

    carliunity

    Joined:
    Aug 3, 2013
    Posts:
    6
    This is the error.

    IndexOutOfRangeException: Array index is out of range.
    SpawnManager.GenerateWave (Int32 waveNum, Int32 rscCount) (at Assets/TDTK/Scripts/C#/SpawnManager.cs:346)
    SpawnEditor.OnGUI () (at Assets/TDTK/Scripts/C#/Editor/SpawnEditor.cs:255)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

    I have also tried removing the collider components and nothing. For now, I have implemented a quick fix that simply enables the collision on a block tower on a coroutine 1 second after start, This only affects block towers that are placed in the editor.
     
  12. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    This is real strange. Your error seems to be coming from SpawnEditor. Not sure why it's there but it shouldnt have anything to do the pathing.

    Thing is I've been running the scene from Unity3.5 so to match yours I tried gettng a fresh download from AssetStore in Unity4.2. I'm using default scene MazeMultiPath. Yes there are problem initially when the collider is there. I removed the mesh collider component on 3 of the child platform. In fact you can delete them, they are just there for as visual indicator. After the collider is gone, everything works ok.

    $TDTK_screen_shot.png

    Perhaps you should try with the child platform deleted.
     
  13. carliunity

    carliunity

    Joined:
    Aug 3, 2013
    Posts:
    6
    The error with the spawn editor happens EVERY time I generate a set of waves. I haven't noticed any side effects though. Yes, deleting the mesh colliders did fix that problem. I'm still concerned about the other problem. On the scene ExampleMazaMultiPath&Platform , If you change the first wave from Shuttles to TankIII, then seal of the empty gap shown in the image with another block tower, they will sometimes levitate when they cross a tile that was inhabited by one of the block towers.

    $Test4.png
     
  14. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    My guess is some of the variable for procedural wave generation (most probably, path and resources) haven't been setup properly. This is a known issue. I've fixed it in the coming update. For now I would suggest you to manually make sure all these has been assigned.

    This issue has also been fixed in the coming update as well. I've pm you the fix. Please try that.
     
  15. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    $TDTK_scMix.jpg

    A quick announcement that a new update has just gone live on AssetStore. Check out the new updated demo! The visual enchancement is pretty awesome!

    Anyway, the update is as follow:

    Version Change – 2.2.4
    addition/change
    • Icon can now be deleted before building to reduce build size (for NGUI only)
    • Added modular tile set to the package, applied to the demo scene.
    • Input for Ability system has been changed (right/left click has been swapped).
    • Added mobile support for abilityManager
    • Added mobile support for drag and drop building scheme
    • Tower position during drag and drop phase will now 'sticked' to the cursor, as opposed to the last valid position.
    • Change how overlay is assigned in the editors.
    • Add option for pre-calculated hit result upon shoot, to prevent tower for firing redundant shot (configure in GameControl)

    bug fix
    • fix bug with spawn editor where generate wave in finite mode gives error
    • fix bug where ability armor reduction on creep doesn't work
    • fix bug where creating a new scene doesn't work with only 1 resource
    • get rid of the warning sign in Unity4.0 and up
    • fix bug where path-indicator does not point in the right direction in Unity4.0 and up
    • fix bug where DamageTable is not taken into account for shield
    • fix bug where shield pierce doesn't work
     
  16. TensonHanzo

    TensonHanzo

    Joined:
    Sep 16, 2012
    Posts:
    13
    Nice, I'm really liking the make-over of the demo scenes.
    Lookin' good
     
  17. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    Thankyou!

    I'm very fond of them myself.
     
  18. eajones

    eajones

    Joined:
    Aug 1, 2013
    Posts:
    45
    The update looks awesome!

    This question may have already been asked--and if so, sorry--but is there any way to have the tower upgrade option be right adjacent to the tower, or is that GUI-driven?
     
  19. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    I dont get it. Do you mean having the selected tower info panel floating at where the tower is positioned on screen?
     
  20. chris56728

    chris56728

    Joined:
    Jul 26, 2013
    Posts:
    7
    Hello Songtan,

    First of all - i recently bought your toolkit and it is fantastic! Really great work. I have a question though.

    With your toolkit is it possible to make a game similar to plants vs zombies?

    I setup a simple linear scene with tanks spawning. I applied the attack script and set up a block tower but they just drive right through the block tower. Just wondering if you have this functionality built in or does it need to be modded to do that?

    Thanks!
    Chris
     
  21. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    Hi Chris,

    Thanks for your purchase. I hope you enjoy working with it.

    I cant guarantee that you will be able to replicate the exact gameplay of PvZ. The thing is I myself havent play through the game entirely so I dont know all the gameplay mechanic they have. But you can certainly setup a scene that play more or less like that, multiple lane, creep comes in, stop and attack tower and so on.

    By default, the creep has their attack mode set to RunNGun and the target area set to AllAround. The setting that you are looking for are "StopNAttack" with the target area set to either "Obstacle" or "FrontalCone". That way the creep will only attack towers directly infront of them and stop to attack instead of running past the towers. At any rate, you should play around with the parameters to see what's what.

    Hope this helps

    Song
     
  22. chris56728

    chris56728

    Joined:
    Jul 26, 2013
    Posts:
    7
    Song,

    Thanks for the quick response!

    Very cool! I just tested that out.

    I'm sorry if this is an ignorant question. I was watching your videos and you mentioned your documentation. Do you mean documented code or an actual documentation pdf/webpage/etc? If you're talking about a documentation pdf/webpage etc I can't seem to find it.

    Thanks,
    Chris
     
  23. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    There should be two pdf files within the TDTK folder. One's the full documentation covers all the core component. The other is a release note covers the more recent addition.
     
  24. eajones

    eajones

    Joined:
    Aug 1, 2013
    Posts:
    45
    Songtan,

    You are correct, I do mean "having the selected tower info panel floating at where the tower is positioned on screen". The current upgrade/sell feature forces the mouse (or touch or whatever) to the side of the screen, away from where the tower is located. Is this position able to be floating at where the tower is on the screen rather than on a side of the screen?
     
  25. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    It's certainly possible to have a floating tower panel. The thing is it's nice when the panel shows up where the tower is like the build buttons in PointNBuild mode. However with the current design of UI, I'm not sure if it's the way to go. See the problem is the current panel needs to display all the information about the tower, consequently it takes up a hug chunk of screen space. If it's a floating panel, first it defeats the purpose of giving you the idea of where the selected tower is based on the panel position. Second it blocks the game screen, breaking the play immersion. So I really wouldnt recommend it unless you are having a much compact or smaller panel. But then that very much depends on your game design, do you cut down the usage of stats or you simple dont show all that information. That is something I cant do for the toolkit as it must take into consideration of all possible setup. Hope you understand.
     
  26. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    A quick notice that a new update has just gone live on AssetStore. It's a hot-fix for several bugs I missed or accidiently introduce when working on the last update. Again, the full list of changes:
    • fix bug for tower aiming in separated barrel mode
    • fix bug with path-indicator when paused
    • fix timeScale issue when loading a new scene when paused
    • fix bug with dragNdrop build scheme where it stop working if a DragNDrop process is cancelled
     
  27. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    Hey Song, I just updated to the latest version and I am getting a conflict -
    "Rotate.cs exist in multiple locations" I am wondering if you could rename to something like TDTKRotate.cs
    Thanks :)
     
  28. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    Hm.. that script has been there for quite a while. I could rename it no problem. But It's not that important really, you can delete it without breaking anything (just the aoe and support tower would stop animating that's all). So instead of me updating the package for one single files. You can just delete it or rename it yourself for the time being.
     
  29. Cogent

    Cogent

    Joined:
    May 14, 2013
    Posts:
    356
    We're having trouble just formatting the strings for Resource and StarPoints in one of the NGUI examples, ExampleLinearMultipath.

    Since the strings are assigned to cloned ResourceItem labels you can't format them at design time correct?, and it's proving difficult to format them in UInGUI.OnResource.

    Why would this be done this way? One of the selling points of NGUI for example is design time formatting of the UI.
    Is there a reason the Resource/StarPoint labels are done differently than score, wave etc?

    We're spending time on something that seems like it should be drag+drop.

    Is there an easy way to do this that we are missing?

    UInGUI.cs
    Code (csharp):
    1. void OnResource(){
    2.  
    3. //make sure the label for resource is assigned
    4.        
    5.         //get all resource value
    6.           int[] rsc=GameControl.GetAllResourceVal();
    7.  
    8.                 for(int i=0; i<rsc.Length; i++){
    9.             hud.rscList[i].label.text=rsc[i].ToString();
    10.         }
    11.     }



    While I'm here I'd also like to point out that, at least for me, in Unity 4.2 and 4.21 "Generate" in the Spawn editor locks up the Unity Editor after minor changes in Configure such as Starting Unit Count etc. Sometimes it works, sometimes it doesn't and throws "ArgumentOutOfRangeException: Argument is out of range. Parameter name: index"

    Just playing around with TDTK is fun, hopefully the issues can be worked out so we can actually start development with it. Right now I can't see moving forward with it.
     
    Last edited: Sep 13, 2013
  30. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    Hmm, I would still like it to be working, and changing the name from your end will help me without having to change the name from my end everytime I update :)
     
  31. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    The reason it's done the way it's done is that it needs to support flexible amount of resource type. Note that there will always be only 1 life, wave and score label but you can have however many resources you want. So instantiate the ResourceItem in run time will make sure there's enough ResourceItem to go with it. This is not just for the HUD, there's tower tooltip, tower panel (buy and sell button) to consider as well. Of course it can be done via drap and drop like you said. But It would be tedious to create and assign the resouce item to the script everytime the number of resource type in game is changed. Mind you user without in depth knowledge of NGUI or understanding of how the script is run will struggle just to get this right. In short, I go for this route so that the process can be automated.

    So what exactly are you trying to do with the Resource Item then? If you let me know I could probably help to figure an easy way to do it. Just fyi, it's not totally fixed. It just that all ResourceItem will be of the same format. But you can still adjust the position, size, etc.
     
  32. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    I've already made the name change and pm the package to you. Check your inbox. The change will be there in the next update. :)
     
  33. Cogent

    Cogent

    Joined:
    May 14, 2013
    Posts:
    356
    We need the Resource and StarPoint display separated so we can place them in a variety of configurations. As they are now they are very difficult to format, for example if we wanted the Resource value to be 10000 it will crowd the StarPoint value. If they were separately placeable this wouldn't be a problem. NGUI seems to be working fine but is there another way to assign the result in UInGUI.OnResource to different labels that we can place separately?
     
  34. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    Sorry for the slow respond. I went out for a while after my last post.

    Please give me some time. I'll make the modification to allow you to setup the ResourceItem manually for the HUD at least. I'll try to get it done by tomorrow. I dont quite understand what do you mean by "assign the result in UInGUI.OnResource to different labels that we can place separately". Do you mean to assign the ResourceItem manually in editor mode or setting the value in runtime?

    Btw thanks for notifying me that generate wave sometime freeze the editors. I did come across this before as I have been doing the development on unity 3.5. I'll try to find out what's the issue.
     
  35. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    @Cogent, just pm you a link to the modification you need. Please check. :)
     
  36. Cogent

    Cogent

    Joined:
    May 14, 2013
    Posts:
    356
    Thx for the support Song :) Will Check

    Just meant that we needed to be able to position the 2 values independently in the editor.

    You've earned your money today. Will try not to bug you further. :)


    Update: Working! Thx again.
     
    Last edited: Sep 14, 2013
  37. Rolands

    Rolands

    Joined:
    Aug 15, 2010
    Posts:
    90
    hi
    i have downloaded the latest version of TDTK and am i am trying to find UIiOS.cs script, but as far as i see threre is no UIiOS.cs???
     
  38. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    Fyi, UIiOS is now obsolete and no longer supported. You can either use UInGUI.cs or UI.cs instead. Both should be ok to use for iOS.
     
  39. Brensdumb

    Brensdumb

    Joined:
    Mar 13, 2013
    Posts:
    11
    I bought this porject and found it amazing, then after updating it there were error codes that I didn't create. Can you please help me?
    The error codes were:
    Assets/TDTK/NGUI_Free/Scripts/Interaction/UIButtonTween.cs(38,52): error CS0117: `Direction' does not contain a definition for `Forward'
    and
    Assets/TDTK/NGUI_Free/Scripts/Interaction/UIButtonPlayAnimation.cs(39,52): error CS0117: `Direction' does not contain a definition for `Forward'
    Thank you.
     
  40. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    This looks like NGUI error. Did you updating a project containing NGUI full? If so, I would suggest you to try delete NGUI folder and reimport the NGUI full.
     
  41. WhiteCastle

    WhiteCastle

    Joined:
    Sep 6, 2013
    Posts:
    12
    I was wondering how to destroy a tower upon collision by creep?
     
  42. Brensdumb

    Brensdumb

    Joined:
    Mar 13, 2013
    Posts:
    11
    ok i will try that, thanks
     
  43. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    You can add following to UnitTower.cs.
    Code (csharp):
    1.     void OnTriggerEnter(Collider collider){
    2.         if(collider.gameObject.layer==LayerManager.LayerCreep() || collider.gameObject.layer==LayerManager.LayerCreepF()){
    3.             Dead();
    4.         }
    5.     }
    6.  
    Then you will have what you want. But of course normal collision setup applies, you need to set the collider to trigger, rigidbody and so on.
     
  44. justforthesis

    justforthesis

    Joined:
    Sep 28, 2013
    Posts:
    11
    Hi song, why does when I load my main menu scene from the game I think all functions become disabled because the play game isn't working and the particles become disabled but the sounds are still working. Hope you can help me asap thank you.
     
  45. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    Hi Justforthesis,

    Sorry for the slow respond. Can you please be elaborate more about the problem. So you load the main menu from a game level? Which main menu and which game level? your custom menu and level or the default examples? When when you say all functions is disabled, which function specifically? If you are refering to default menu, it just consists several buttons loading each corresponding level. Are you saying that doesnt work? I've just tested on my end using the default example scene, everything seems to be working fine, the music stop playing as soon as you load another level.

    If you are using your own custom scene, you will have to let me know what is in there. How they have stop working. It helps too if you let me know how do you initiate or start the things that are now not working. Obviously I cant help you if I dont know what the problem is specifically.
     
  46. DreamEnder

    DreamEnder

    Joined:
    Apr 12, 2011
    Posts:
    190
  47. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    I've downloaded it. Look and play pretty alright. Well done and good luck with the coming store feature!

    Can I show this to anyone who asked?
     
  48. DreamEnder

    DreamEnder

    Joined:
    Apr 12, 2011
    Posts:
    190
    Show anyone you'd like.

    Thanks again for the awesome kit. It was a breeze using it and I'll be sure to get your turn based kit soon.
     
  49. justforthesis

    justforthesis

    Joined:
    Sep 28, 2013
    Posts:
    11
    HI song, I'm using a custom main menu and level . This is where problem occurs I play my game from the main menu click the start button then the first level loaded but when I go back to the main menu from my custom level, I don't know what is happening but it's like hanging because the fire particle isn't working anymore. My main menu isn't just GUI elements it has a terrain and some models of cars, barrels,fire particles and some NGUI for the start,instructions, credits and quit. My level scene consist of TDTK (everything I use including turrets and creeps) and just a terrain. One more thing when I put a FadeInOut http://wiki.unity3d.com/index.php?title=FadeInOut
    in the main menu it doesn't fadein when I load it from the level scene but it's working from the beginning of the game the problem is when I go back to main menu from the level scene. But everything is working except for this one. Sorry for my English I'm little bit struggling.
     
  50. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,469
    So the problem is the main menu doesnt work when it's loaded from a game level? Is there any TDTK element in your main menu? At any rate, I'm afraid this is not a TDTK issue. As far as I'm aware, TDTK doesnt affect stuff across scene. So whatever happen in the game level shouldnt break anything in the menu.

    My guess is, you have some static initiation process running on the menu scene to get the scene running. And because it's static, it doesnt initiate when the menu is loaded again. To verify this, check if the menu is working if you just play a game scene (without starting from menu), then goes to menu. I dont think the camera fade has anything to do with the problem. Try removing it and see if the problem persists.
     
unityunity