Search Unity

TowerDefense ToolKit 4

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

  1. SignalZak

    SignalZak

    Joined:
    Nov 13, 2014
    Posts:
    12
    First of all, thanks for the cool plugin! We're trying it out right now.

    We've discovered some of the code has been deprecated as of Unity 5.0. We typically set warnings as errors, so for now we're using #pragma to ignore the warnings to successfully compile. I suggest updating the code with ifdef UNITY_5_0 guards for backwards compatibility.

    For example, the new ParticleSystem emission code is a bit odd. When we updated our last project from 4 to 5 I had to do a lot of boilerplate that looks like:

    var rate = emission.rate;
    rate.mode = ParticleSystemCurveMode.Constant;
    rate.constantMin = rate.constantMax = myEmissionRate;
     
  2. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I'm not sure if you are posting at the right thread. First I don't recognize any of the code you have shown. Then TDTK has been updated to Unity5 compatible to quite some time. It's currently being developed in 5.0 and I've been using myself for quite some time (on both 5.0 and 5.2) and I'm pretty sure there's no deprecated code in current build. In fact I've just checked to be sure. If this is from TDTK indeed, please show me the complete warning message in the log so I can fix it.
     
  3. SignalZak

    SignalZak

    Joined:
    Nov 13, 2014
    Posts:
    12
    My code example was from our own project as an example, compiling with Unity 5.3.0f4.

    We just grabbed the 3.1.1 version. You should be able to replicate our issues if you create files named "csc.rsp", "gmcs.rsp" and "smcs.rsp" in your Assets folder with the single line "-warnaserror+"

    (See http://docs.unity3d.com/Manual/PlatformDependentCompilation.html under Global Custom Defines).

    If you use this method to force warnings as errors, here are a few of the erorrs:
    • Assets/TDTK/Scripts/Editor/_MenuExtension.cs(39,43): error CS0618: `UnityEditor.EditorApplication.NewScene()' is obsolete: `Use EditorSceneManager.NewScene (NewSceneSetup.DefaultGameObjects)'
    • Assets/TDTK/Scripts/PathIndicator.cs(31,33): error CS0618: `UnityEngine.ParticleSystem.emissionRate' is obsolete: `emissionRate property is deprecated. Use emission.rate instead.'
    My sample code above was our way to quickly "fix" the emissionRate errors.
     
  4. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I see. My apologies. I'll look into a fix them before the next update.

    Many thanks for letting me know and showing me the tip. I was not aware of this before. :)
     
    SignalZak likes this.
  5. Luciurr

    Luciurr

    Joined:
    Aug 2, 2015
    Posts:
    2
    Hi. I use the AudioManager for playing music in the game. But the music continues to play in other scenes in the menu. How can I make the music stops when I'm gone from the level and start all over again when I run another level? (I have several audio tracks play randomly)
     
  6. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Very sorry for the slow respond. I've been travelling for these few days so I don't have internet access all the time.

    You can try remove the line DontDestroyOnLoad in Awake() in AudioManager.cs. This will stop the music as soon as a new scene load. My intention with this is of course to stop the music being cut off abruptly when loading a new scene.
     
    Luciurr likes this.
  7. sacredcow

    sacredcow

    Joined:
    Feb 12, 2016
    Posts:
    1
    Hi Mr. Songtan I've bought your asset, it is really good and allows to create a complete Tower Defense game really fast, so far it has been really easy to work with but I just got 1 question: how can I modify the creeps behavior so that if the path is completely blocked, the creep must stop and attack the object that is blocking it?
     
  8. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Thanks for your purchase and I'm glad you enjoy it.

    I'm afraid the modification you are looking for is not that straightforward. The first thing you need to do would be to allow player to completely block the path. That is relatively easy. You only need to remove the line if(platform.CheckForBlock(pos)) in _CheckBuildPoint() in BuildManager. Now the tricky bit is how do you determine which tower is blocking the path. Then you need to create additional behavior for the creep to move to a certain tower and attack it. I don't think you can just modify any existing code to do that.
     
  9. Dom Kost

    Dom Kost

    Joined:
    Mar 6, 2016
    Posts:
    6
    Hey, Is there a way to increase the grid size on the tower platforms, so I can spawn bigger towers? I made my own custom towers, but if the box collider is too big the grid squares around the tower become unusable (clicking on them does nothing).

    EDIT. Maybe theres something I can do in the PlatformTD script?
     
  10. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    You can adjust the grid size by changing the value of 'GridSize' in BuildManager. Alternatively you can change the size of the collider on your tower prefab (making them smaller). Hope this help.
     
  11. unichron

    unichron

    Joined:
    Apr 2, 2016
    Posts:
    1
    I really like your toolkit, first off. Really great work. I was hoping you could help me out with one thing, though. How do you block areas off? Say if you have a maze portion where the user can put towers, how do you put obstacles on map that creeps must go around and/or places where user cannot place towers (within the maze portion)?
     
  12. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Glad you like the toolkit.

    To block an area off the maze, you can simply place a collider covering the section/tiles you want to block off. If you don't want the grid to show up at the blocked off area, you will need to use other means to visualize the grid rather than the renderer on the platform itself. This can be done with relatively ease by using visualization of other renderer (in the form of other game-object) to to fill up the actual grid.

    There are two example of this in the default scene, 'TDTK_Demo_Maze' and 'TDTK_Demo_Maze_Terrain' specifically. Both have mazed-platforms with section of them blocked off. These platform have their grid rendered using a series of child object instead.
     
  13. Geoffc

    Geoffc

    Joined:
    Feb 4, 2013
    Posts:
    39
    Hi Song,

    Is there a way to make the build menu and ability menu generate up and down so they can be displayed horizontally?
     
  14. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Of course. The arrangement of the build and ability buttons are control by their respective layout group. You simply need to change with the setting. In your case, change the horizontal layout group to vertical layout group. Please refer to the image to see what I'm talking about.


    You can refer to this link for more information - http://docs.unity3d.com/Manual/comp-UIAutoLayout.html
     
  15. alexsander890

    alexsander890

    Joined:
    Apr 15, 2013
    Posts:
    61
    Hello I want to buy your Asset , but there is a question
    on a mobile platform.
    1. When selecting a tower (on mobile with touch on) you can select another tile. "
    touched once I saw characteristics can be canceled and you can confirm another touch"
    2. Almost impossible to use Strike or Shockwave. "
    if you use the standard moving your finger across the screen then Almost impossible to use Strike or Shockwave
    "
    You may need to disable the movement of the screen during the event
    These questions asked JunesiPhone on page 31
    Do you plan to fix these bugs ? If yes, then when?

    Now only those little bugs stop me from buying

    sorry for my English
     
  16. mahdijj

    mahdijj

    Joined:
    Sep 24, 2015
    Posts:
    31
    can i use from both of tdtk and tdstk in one project?
    when i import both of them i have this errors:
    Assets/TDTK/Scripts/ObjectPoolManager.cs(5,14): error CS0101: The namespace `global::' already contains a definition for `ObjectPoolManager'
    Assets/TDTK/Scripts/ObjectPoolManager.cs(116,14): error CS0101: The namespace `global::' already contains a definition for `Pool'
     
  17. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Very sorry for the slow respond. For some reason unity has stop sending notification to me so I don't realize there has been new post here.

    @alexsander890, yes those has been fixed.

    @mahdijj, you should be able to use both. For the error, simply delete one of the ObjectPoolManager script.
     
  18. alexsander890

    alexsander890

    Joined:
    Apr 15, 2013
    Posts:
    61
    Hi Song,

    I bought your product . He saw that the bug is corrected by the shock wave , but the choice of towers bug is not fixed. pointNBuild method builds a tower with no choice . First you need to see the characteristics of the tower and then used to build
    sorry for my English
     
  19. alexsander890

    alexsander890

    Joined:
    Apr 15, 2013
    Posts:
    61
    one-click viewing tower features a choice , the second click confirms the selection of the tower building
     
  20. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I'm sorry but I'm afraid I can't understand what you are trying to say. Do you mean you need a two click feature on build towers? First click to show tooltip and preview, second click to confirm? If that's the case, it's there. You simply need to enable "TouchMode" on UIMainControl. This is explained in the documentation, in the UI section.
     
    maxaud likes this.
  21. alexsander890

    alexsander890

    Joined:
    Apr 15, 2013
    Posts:
    61
    Yes that's right. Sorry I did not see . I confirm everything is working .
     
  22. maxaud

    maxaud

    Joined:
    Feb 12, 2016
    Posts:
    177
    I have the Realistic Effects pack listed here: https://www.assetstore.unity3d.com/en/#!/content/27523

    I'm trying to set up a FireRay as a ShootObject. I'm having a difficult time setting it up.

    It will spawn the ray but have it 90 degrees off, or if I adjust the settings it will look like it's starting to shoot it but it's doing the warm-up phase of the ray and doesn't actually shoot a beam.

    The FireRay is set up in a prefab as follows:

    FireRay
    - Tagged as ShootObject
    - Sphere Collider with Radfius of 0.1
    - Shoot Object Script set as Beam, also tried Effect
    - Effect Settings - Script from the Realistic Effects Pack

    FireRay/LazyLoad
    - Lazy Load Script - Loads Ray with a delay

    FireRay/Ray
    - Line Projectile Collision Behaviour Script - References Line Render and Effects on Hit and Hit Object

    FireRay/Ray/ParticleScale/Distortion
    - Particle System

    FireRay/Ray/LineRenderer
    - Line Renderer
    - UV Texture Animator
    - Fade In Out Shador Color​
     
  23. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    It's very tricky for me to comment on this. I don't know how those script on the prefab control how it behave or work. There's two way of doing this. Making it a beam type shoot-object or an effect type shoot-object. If the control script can be configured to work with TDTK (the beam fires and hit the right point), then you can make it an effect object. However I think it is very unlikely that the script would be perfectly compatible. So chance are you need to set it as a beam type shoot object.

    For beam type shoot-object, the key is the setting on the LineRenderer component. Make sure it doesn't use world space and the transform is pointing towards +ve z-axis. If this is configured correctly, the ray will always shoots correctly. If not, the script on the prefab itself must have interfered. Also there shouldn't be any collider on a beam type shoot object.

    Bottom line, I would disable all the effect control script on the prefab to set it up like a normal beam shoot-object (refer to the default beam shoot-object) to make sure the beam works. Then disable the control script to see if that breaks any thing. If yes, you will probably need to disable it, or modify it so it works with TDTK.
     
  24. maxaud

    maxaud

    Joined:
    Feb 12, 2016
    Posts:
    177
    Don't use World Space? The SO_Beam_Laser is Using World Space though?

    I'm not sure what "+ve z-axis" means.

    In this screenshot I have the prefab on the bottom of the screen.
    The turret is currently shooting a simplified version of the prefab that is just the LineRenderer.
    It's shooting the creep on the right hand side of the screen.

    Additional question. Is it possible for the beam to stay on all the time rather than being shot in pulses?

     
  25. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Oh sorry. it seems like I have got my facts wrong in my last post. Still, It should work if you try to use the same setup as SO_Beam_Laser. Anyway, I think it's easier for you to just email me your current not working prefab to me so I can take a look at it.

    What do you mean exactly by stay on all the time? When it's firing at one single target? Well, you can try give the tower a very high firing rate. Or you can give the beam-shoot-object a long beam duration.
     
  26. maxaud

    maxaud

    Joined:
    Feb 12, 2016
    Posts:
    177
    I managed to get it shooting properly by starting completely over and reimporting the prefabs.

    It looks like there are two ways to get the beam to be continous. Both have undesirable results.

    Option 1) If I set the cooldown to zero I can get a continuous ray but I have to set my damage pretty low or the creep health high.

    Option 2) I set the beam duration High but when the turret switches from one target to another the original beam is still there for a short period.

    Another thing I would like to do with a continuous beam is have the Hit Effect stay on with the beam and move with the creep. It looks like it has to have it's duration turned down too so it can reload each time the beam does a new hit. This has a few drawbacks as well. I have to prewarm the particles system and it doesn't look as good as a particle system that loops.

    Is there a better way to acheive the results I would like? I see the option for an "Effect" rather than a "Beam" but I don't see much documentation on how to add my own effect.

    Thanks!
     
    Last edited: Apr 20, 2016
  27. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I can understand what you are trying to go for. Something like a beam that charge up and then continuously fire at a target until it's destroyed or get out of range. Frankly that is a bit more than what TDTK can support by default. It require a more precise scripting control. Due to the various way this can be visualized, it's difficult for me to write a script that can cover all possibility. So you will need some custom script to get this working correctly.

    The closest you can get without needing to do any coding is to use option1. Instead of using zero as the cooldown, use something like 0.1 or 0.2. That is plenty enough to create an illusion that the beam is continuously damaging it's target. You can always adjust the damage to get the dps you want. Also as long as the charged up time for the particle system are not too long, you needn't prewarm it. You can set those particle as shoot and hit effect which has it's own duration so they can persist past the beam duration. And since the firing at a high frequency, it will create an illusion that the hit effect moves along with the target.

    "Effect" type shoot-object doesn't really do anything. It's intend for shoot-object that visually doesn't need to aim or travel towards the target (a muzzle effect for instance). If you want to use a custom script to control the visual, you can probably set it as an effect type.
     
  28. maxaud

    maxaud

    Joined:
    Feb 12, 2016
    Posts:
    177
    Thanks for the response.

    I'll have to do some fine tuning to get what I want.

    If I set the hit effect to persist past the beam it tends to linger after the creep has already been gone so I think I will have to figure out another way to achieve the result want.

    Thanks for a great product and prompt response.
     
  29. maxaud

    maxaud

    Joined:
    Feb 12, 2016
    Posts:
    177
    Without using additional waypoints is there a way to reroute creeps around obstacles? Let's say that I have a path that connects two platforms. If I have some sort of ubstruction block that path, is there a way to route around it without making any additional waypoints? out of the box.

    Additionally, If this was to happen on a platform, is there a way to do it there? I see I can block building on a tile if I have an object there but the creeps walk right through it.

    Thanks again.
     
  30. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    From waypoint to waypoint, I'm afraid the only way to have the creep route around a specific obstacle is to add more waypoints.

    On the platform however, you can just put a collider in the section you wish to block off. This would prevent creeps from walking on that section as well as tower building. However you will have to do this before the game start since the calculation is only performed once during the initialization of the game. For runtime, you will need additional coding to prompt the platform to recalculate its path whenever you place/remove a collider on the platform.
     
  31. maxaud

    maxaud

    Joined:
    Feb 12, 2016
    Posts:
    177
    Cool that makes sense. Can you point me in the direction of where the current code is that does it at initialization?
     
  32. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I think there's two places you will be interested in. First the Init() function of PlatformTD.cs, specifically at the later half of the function where it generate the navigation node and search a route. Then there's the BuildTower() function, where it's called whenever a tower is built on the platform, to update the path if need be. Hope this help.
     
  33. maxaud

    maxaud

    Joined:
    Feb 12, 2016
    Posts:
    177
    Perfect. Thanks for the great support. I know some of this is custom and the code is more as a starting point so I appreciate you going above and beyond in these questions I have.
     
  34. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    No problem. If you have any more questions/problems, just fire it away. I'm more than happy to help.
     
  35. Dom Kost

    Dom Kost

    Joined:
    Mar 6, 2016
    Posts:
    6
    Apologies if this is a common question.

    Is there a way to add sounds and particle effects to creeps using the Unit creep script in the inspector. For example a blood spurt effect on creep hit.

    Also I have a problem with the animation clips:
    The Spawn, Move and Destination clips I assigned work correctly, but the Death clip does not respond. Of course I tried using different animations to test this out but no animations work when I drag them into ''Death Clip'' slot.
     
  36. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    No worries.

    I take it what you mean is to have sound and particle effects specific to creep rather than the shoot object? I'm afraid you will need to do some customization. You can modify the script Unit.cs so that you can assign your custom effect and have them spawned in the function ApplyEffect(). That function is called whenever a unit is hit by the way.

    About death animation, I have to say I have no such issue on my end. It could have been a bug that I've fixed since the last update but I can't really remember. If you can email me I can send you my scripts and see if that fix the problem. Also if you are not using the latest version, it may help you if you just update it to the latest version.
     
  37. Dom Kost

    Dom Kost

    Joined:
    Mar 6, 2016
    Posts:
    6
    Thanks,
    I have sent you an email. I think I have the latest version of the toolkit.

    I found a new issue:

    Adding a platform to the path causes an error and doesn't allow me to build any towers in that area. Also the path should keep going right from the grid, but it doesn't connect.
     
  38. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I've send the animation fix to your email. Please try it out.

    As for the path error, There's two possible way how this can happen. Either you have add the platform as the final waypoint of the path. Or you have accidentally remove the PlatformTD component on the platform waypoint bt still has it layered as platform. From the screen shot, the first scenario is the more likely case. If that is the reason, Try add another non-platform waypoint at the end of the path. If not, can you describe to you how exactly have you done your scene. It would be most helpful if you can give me the first error that shows up as soon as you run the game.
     
  39. Dom Kost

    Dom Kost

    Joined:
    Mar 6, 2016
    Posts:
    6
    It is not the last waypoint, if you look at the inspector Element 16 is the final empty object waypoint. In the picture above.


    Here are the errors I'm getting when I run the game. (I think the second error is unrelated and I know how to fix it)
    The first error happens immediately on play.
    The third error happens when I click on the platform.



    I first opened the default fixed path scene provided in the toolkit. I created the zigzag path going uphill with empty object way points and then added the platform to the second last waypoint node.
    The scene is just simple terrain, maybe its causing a problem with the box collider? If I open a new fixed path scene and add the platform to a waypoint it works fine.

    I just tried some things out. The platform works fine if I raise it high in the sky, not near the terrain.
     
  40. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I can't replicate the error. However from your description the terrain is definitely the problem. My guess is the collider on the terrain is blocking out path or something along those line. Have you assign those terrain's layer to 'terrain'?
     
  41. Dom Kost

    Dom Kost

    Joined:
    Mar 6, 2016
    Posts:
    6
    You are awesome. I assigned the layer as Terrain and it works fine now. It's odd because platforms work fine without layers when they are not connected to the path.

    Thanks for your help as always, Song.

    I will make sure to give credit to your amazing toolkit when my project is finished in about 2 weeks+you can play it when it's done if you're interested :)
     
  42. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Sure. Glad to help and good luck with your project.
     
  43. jim00

    jim00

    Joined:
    Feb 1, 2015
    Posts:
    57
    does TDTK play well with Playmaker?
     
  44. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I'm not really sure what you are asking here. TDTK is a stand alone framework. It's not intended to be used with Playmaker. At least not in the sense that using Playmaker to interact with it. However they should be compatible with each other as far as I know. You should be able to use them along side each other. For instance, use TDTK to make the gameplay level and Playmaker to handle other stuff like main menu. Hope that answer your question.
     
  45. jim00

    jim00

    Joined:
    Feb 1, 2015
    Posts:
    57
    Hi,
    Do you have any tutorial on how to replace the tower, creep, FX, landscape etc. I have try using some 3rd party assets but couldn't make it to work. If not, can you make a simple tutorial please. thanks.
     
  46. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Have you look through the documentation? Most of the stuff you need to know has already been explained there. I don't think I can explain it any more than how I did in the documentation. Perhaps you can let me know in particular how you are stuck? Then I can answer more specifically.
     
  47. Proto-G

    Proto-G

    Joined:
    Nov 22, 2014
    Posts:
    213
    Yes, it works. I'm using Playmaker along side TDTK for my current project.
     
  48. zinkins

    zinkins

    Joined:
    Jun 3, 2015
    Posts:
    21
    Hi! Thanks for such amazing asset :)

    Could you please tell if it supports individual settings for towers as skins, names etc? I mean if I create my own tower and want to name different instances of tower and make different skins how can I do that?

    Also does it support items for towers? For instance, if I want to create many different types of weapon and defence for one type of tower.

    I want to create game similar to Defender's Quest where are heroes as a towers.
     
  49. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    You can create your own tower however there's no way to have unique name and skin during runtime, not by default anyway. Each tower created is essentially a prefab, the player can build it over and over again. You will have to do some code modification to limit a tower prefab and assign unique name/skin during runtime.

    Also I'm afraid item system for tower is not available as well.
     
  50. zinkins

    zinkins

    Joined:
    Jun 3, 2015
    Posts:
    21
    ok, thanks anyway!