Search Unity

  1. Click here to see what's on sale for the "Best of Super Sale" on the Asset Store
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

TowerDefense ToolKit 4

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

  1. Proto-G

    Proto-G

    Joined:
    Nov 22, 2014
    Posts:
    108
    Does anyone have this fix? I'm having the same issue where my return path is sending the units back down a straight path to the initial spawn point instead of following the initial path that changes when towers are placed in the way...

    Thanks!
     
  2. Proto-G

    Proto-G

    Joined:
    Nov 22, 2014
    Posts:
    108
    I pray that Song Tan is ok, in Jesus name. Amen
     
  3. toddkc

    toddkc

    Joined:
    Nov 20, 2016
    Posts:
    89
    I too hope he is doing well, but minus the religious stuff.
     
  4. bastilar

    bastilar

    Joined:
    Apr 9, 2017
    Posts:
    17
    That's not a good sign. I still have to code the save function and will need to ask for that. Maybe Songtan taking a much needed vacation or he's hard at coding work.
     
  5. Proto-G

    Proto-G

    Joined:
    Nov 22, 2014
    Posts:
    108
    Religion is based on law and is from man. Do this, do that, because it's the law. Faith is from God, I do this and do that because I have faith in Him and desire to be obedient to His Word. Just wanted to share. I once had your view, but then I was broken and in need. I started seeking Him and found the truth, not through words, but through supernatural power, undeniable proof. He is and He rewards them who seek Him diligently.

    In any case, it's not like Son Tan to just disappear without notice. So I really do hope he's ok :)
     
  6. bastilar

    bastilar

    Joined:
    Apr 9, 2017
    Posts:
    17
    I'm almost done with my game and I've saved the last part for cloud saving function. I was wondering which asset to use?

    I was thinking of trying "easy save the complete save and load asset" kit by moodkie. Anyone else with saving function (like on steam, google play, apple ios, etc) tried other assets?

    Since Song tan appears to be MIA I'm kidn of hoping someone else can help out. Thanks.
     
    Niroan likes this.
  7. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    374
    Does this asset support creating 2d TD like random dice?
     
  8. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    52
    All i see is a big blue screen.
    Im running URP what am i doing wrong?

     
    MaxiMaximaal likes this.
  9. toddkc

    toddkc

    Joined:
    Nov 20, 2016
    Posts:
    89
    Try SRP.
     
  10. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    52
    I made it work in URP figured it out
     
    toddkc likes this.
  11. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    52
    Is there a guide somewhere to find out where it safes all data. I dont want my users to reload game everytime they connect to game.

    i want all progress and Tower data to be loaded from cloud. Can anyone show me where these data are stored?
     
  12. toddkc

    toddkc

    Joined:
    Nov 20, 2016
    Posts:
    89
    I don't believe TDTK has any saving. You would need to add that yourself.
     
  13. bastilar

    bastilar

    Joined:
    Apr 9, 2017
    Posts:
    17
    Yeah I want the same thing but unfortunately we have to figure it out on our own. The TDsave script uses playerprefs (see documentation) but I'm still new to coding so I don't qutie understand what it does yet. Maybe you can start there.

    I'm also looking at other 3rd party saving assets so maybe that will work. I'm guessing for cloud saving we have to figure out how to store the values we want into playerprefs and store /load it from cloud (steam, google play, apple ios, etc). I think that's the basic logic.

     
  14. toddkc

    toddkc

    Joined:
    Nov 20, 2016
    Posts:
    89
    If it uses playerprefs it should do what you need. Playerprefs will save a value so that the next time the game is played that value can be used. What isn't working with it?
     
  15. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    52
    Where do you see the documentation that i saves in Playerprefs? I dont see anything in documentation that says that?.

    I can setup Cloud saving and combine with other save systems, i just need to know what and where it saves stuff
     
  16. toddkc

    toddkc

    Joined:
    Nov 20, 2016
    Posts:
    89
    I didn't think it did, I just read bastilar's post above and thought maybe I was wrong and it did use playerprefs.
     
  17. bastilar

    bastilar

    Joined:
    Apr 9, 2017
    Posts:
    17
    The file you're looking for is this:

    C:\Users\yourcomputername\Documents\unityprojects\yourtowerdefensegame\Assets\TDTK\Scripts\Support_NotInUsed

    filename: TDSave.cs

    If you're able to get this work i'd be VERY INTERESTED in knowing how you did it. I think our bits and pieces can work together to get the result.

    Also, for cloud saving, what solution/3rd party asset you using? Thanks Niroan!
     
  18. pzolla

    pzolla

    Joined:
    Apr 21, 2020
    Posts:
    2
    For what its worth, I did some very early stage testing of saving as I was trying to make sure I could handle all of the major systems one would need to build a full game. I bought Easy Save.

    https://assetstore.unity.com/packag...nt/easy-save-the-complete-save-load-asset-768

    Specifically, I used the auto save functionality:

    https://docs.moodkie.com/easy-save-3/es3-guides/auto-save-saving-without-code/

    I literally had it saving a persistent state in about 10 minutes. Meaning I could exit Unity and reload and resources, perks, score, level was persistent.

    Honestly, I was so pleased with the experience I simply checked it off my list that saving should be doable at my experience level. Of course, this was purely local (not cloud) and certainly not a thorough testing and vetting.
     
    bastilar likes this.
  19. bastilar

    bastilar

    Joined:
    Apr 9, 2017
    Posts:
    17
    Awesome, I had looked into that but havne't gotten up to saving part yet as I'm changing my turret and projectile models. I'll definitely get easy save then.

    I'm glad everyone is working together as a team. =)

     
  20. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    52
    I found out how he coded it all. Then i configured it to work with Cloud, so every data is stored in Cloud so you can take it with you on new devices. The whole idea is making it easy.

    It could be nice to have one part where you convert all data to a object and upload that to Cloud.
    Took 4 hours but its done now.
     
    bastilar likes this.
  21. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    52
    Anyone know how to make a tower melee mode?
     
  22. MaxiMaximaal

    MaxiMaximaal

    Joined:
    Dec 7, 2019
    Posts:
    3
    I'm running into exactly the same issue in URP. Can you explain how you fixed this?
     
  23. FlyingRobot

    FlyingRobot

    Joined:
    May 5, 2012
    Posts:
    456
    Hello Songtan. Just bought your kit. Amazing.

    One quick question. Is there any way to put up walls, which will obstruct the firing of turrets and creeps as well. Can't find the 'TurretLosMode to realistic.'

    Thanks
     
    Last edited: Aug 26, 2020
  24. bastilar

    bastilar

    Joined:
    Apr 9, 2017
    Posts:
    17
    Not sure about that but you could try setting the attack range to very low like 1 or less to make it look like it's melee. Then have the animation play for your "melee" tower units (like swordsman).
     
  25. FlyingRobot

    FlyingRobot

    Joined:
    May 5, 2012
    Posts:
    456
    Seems like SongTan is missing. Any help from the asset users?
     
  26. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,656
    Hi everyone, I'm extremely sorry for not responding for all the post in the last few weeks. For some reason unity has stopped sending me any notification for new post. That and plus I'm too caught up with other stuff to do a manual check. Fyi, I normally respond to a post within the day. So in the future if I ever take more than a day or two to respond to your post, please send me an email about it. Finally, thanks for everyone that have try to answer the question posted here in my stead.

    @MaxiMaximaal, the default asset used for TDTK are not supported by URP or HDRP. If you want to use the default asset you will have to use the SRP. That said, you can used your own URP compatible assets and the framework would work just fine for any rendering mode.

    @FlyingRobot, I've responded to your email.

    @Niroan, exactly what @bastilar has said. Set the range to melee range and used an empty game-object as the shoot-object. Melee and Range makes not difference to the code, it's all about player perception.

    If I have missed your unresolved question, please let me know. Once again, my apologies.
     
  27. FlyingRobot

    FlyingRobot

    Joined:
    May 5, 2012
    Posts:
    456
    Thanks for all your help on the mail. The issue is resolved.
     
  28. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    52
    Im missing the option top build when i click on a Node.
    Its not writen anywhere in documentation?

    Can anyone help me here?
    I want the circle of avaible towers when i click somewhere on map.
     
  29. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,656
    You need to change the Tower Build Mode to 'PointNBuild '. The setting is in UIControl on the gameobject UI.
     
    Niroan likes this.
  30. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    52
    Nice Thanks Songtan!

    I have another issue. when i click on build buttons and have DragAndDrop i can and im over a build spot. It will click trow the the button and build the tower below ui button. Is this a bug? It should not build trow button but if i click another tower it should return and choose that tower?

    Can you please fix this?
     
  31. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,656
    Thanks for letting me know. You can fix this by changing line194 of TowerManager.cs to this:

    if(cursorUp && !UI.IsCursorOnUI()){

    The bold part being the code I've added.
     
    Niroan likes this.
  32. Andblood

    Andblood

    Joined:
    May 10, 2020
    Posts:
    1
    Does it possible to use it for a Multiplayer-TD?
     
  33. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,656
    I'm afraid not. It's single-player only by default.

    There's nothing stopping you from doing your own customization and add multiplayer support. Having said that, I've very little to no experience coding online multiplayer game so I can't provide any help on that end.
     
  34. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    52
    Thanks Song.
    Regarding the build buttons.
    My game currently have 88 different Towers. The Pie chart is just getting to huge when i try to use it. Would it be possible to make more layers in the pie chart?

    the only Way i made it work so far is to use a Rect with horizontal fix so u Can scroll all the Towers.

    regards
     
  35. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,656
    It's possible but it's not straight-forward. I mean how many layers do you need for 88 towers? Do they have to be arrange in any specific order or placed in any specific layer?

    The current solution involve a function that gives you a series of position based on the circumference of a circle given the number of button you have, the size of the button and the radius of the circle (see GetPieMenuPos() in UIBuildButton.cs). The only solution I can think of for now, for what you are asking for is to brute force this by calling GetPieMenuPos multiple time, each time for a single layer of you pie menu. You will have to manually determine the spacing between the layers, how many button you can fit in a specific layer, etc.
     
  36. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    52
    Hmm, its a good question. I actually have tried a small hack on your piechart code. I woul Think that Taking a specific amount of Towers Per chart and Then for each time it reach the amount make a new chart. Or another solution:

    make the pie chart spin able. So you could spin it around that Way you Can fit Them all in One chart ??
     
  37. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    52
    Another issue i have.

    i want to Play a scenario song that keeps looping inside that map. You have win, lose, wave completed and so on.

    can you ADD speciel songs depending on wave and just a general song that Will Play Else.

    like game starts with song1
    When wave 10 or 20 is hit the song change to some other clip as Long as that wave is active?
     
  38. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,656
    Well, it's your game and your design. Do whatever you feel best. Just saying that I don't think it's a good idea to use a popup pie menu that shows everything when you have that much item to show.

    The music player sounds pretty straight-forward. You should be able to write a script that do that without too much problem. Just use SpawnManager.GetCurrentWaveIndex() to check which wave the game is currently in.
     
    Niroan likes this.
  39. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    52
    Nice thanks song. Is there a place where you have writen all the funktions you made? Would be easier to just read some kind of document if you allready made it. But if i Can get current wave index Then its easy
     
  40. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,656
    Unfortunately I don't have anything like that. But you should be able to make a good guess of any function like this is placed based on the script name. Anything to do with spawning is in SpawnManager, Anything to do with the general game logic is in GameControl and son on. Or you can trace where the information on display on the UI is being retrieved from. For the less straight-forward things, you can just ask me.
     
  41. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    52
    Okay, i managed to rewrite you Audio Manager to include the different songs.
    Now i will try to find the place where you increment the wave count :)
     
  42. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,656
    There's a series of event delegate in TDTK.cs that you can use to detect various important event that happen in a game. One being onNewWave which fire every time a new wave started (wave index is changed). You can use that. There's an example of it in UIHUD.cs.
     
  43. Sir-G

    Sir-G

    Joined:
    Mar 12, 2017
    Posts:
    30
    You really need to put up written documentation. I am having major issues integrating it into our current game and bought it because of the mechanics it provided but there is really no clearity towards what is required, what isn't or even how to configure into a current project and scene that is already in the works.
     
  44. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,656
    I'm very sorry for that. Why don't you tell me what you are trying to achieve so I can try to explain and point you in the right direction.
     
  45. toddkc

    toddkc

    Joined:
    Nov 20, 2016
    Posts:
    89
    For the record I think your documentation is fine, and never had any trouble integrating the project into mine, which is a multiplayer vr game so clearly quite different than the base toolkit. This is a complex asset, I think it's expected that less-experienced devs may have some frustration when first using it.
     
  46. Sir-G

    Sir-G

    Joined:
    Mar 12, 2017
    Posts:
    30
    You know making judgements about peoples experience level is like trying to fix an car engine with no clue of what you are doing. I have over 15 years of development experience and I can assure you it is not issue with experience! I am glad that it was easy for you to integrate but maybe our project is a more complicated than what you fathomed for your game.
     
    toddkc likes this.
  47. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    52
    UITooltip.cs has and error if you take a tower. And make 2 upgrades for it.
    Then you upgrade, and fast click it again then it will show a upgrade. Even when there is no upgrade.
    The ELSE statement fails cause there is no more upgrades. This ONLY happens if you upgrade fast.
    Can you please provide me with a fix? or a check if there is actually a upgrade available

    UPDATE: After another check, i can verify that this only happens when you click while a tower is upgrading! So a check that wont allow click if you are upgrading will help.
    Can you give me this??

    So if you click a tower that should not have any more upgrades on it while it upgrades, it will show a upgrade. If you wait till the upgrade timer is done and click upgrade the engine breaks. And gives the following error.


    public void _ShowUpgrade(UnitTower tower, int uIdx, Vector3 pos, int pivotCorner=2, Vector3 offset=default(Vector3)){
    SetPivot(pivotCorner);

    if(tower.GetUpgradeType()==0) labelName.text="Upgrade";
    else labelName.text="Upgrade to "+tower.GetUpgradeTower(uIdx).unitName;

    labelDesp.enabled=false;

    List<float> cost=tower.GetUpgradeCost(uIdx);
    for(int i=0; i<RscManager.GetResourceCount(); i++){
    rscItemList.imgMain.sprite=RscManager.GetRscIcon(i);
    rscItemList.lbMain.text=cost.ToString("f0");
    }

    minHeight=-1;
    rectT.position=pos+offset;

    canvasGroup.alpha=1;
    thisObj.SetActive(true);
    }


    NullReferenceException: Object reference not set to an instance of an object
    TDTK.UITooltip._ShowUpgrade (TDTK.UnitTower tower, System.Int32 uIdx, UnityEngine.Vector3 pos, System.Int32 pivotCorner, UnityEngine.Vector3 offset) (at Assets/TDTK/Scripts/UI/UITooltip.cs:123)
    TDTK.UITooltip.ShowUpgrade (TDTK.UnitTower tower, System.Int32 uIdx, UnityEngine.Vector3 pos, System.Int32 pivotCorner, UnityEngine.Vector3 offset) (at Assets/TDTK/Scripts/UI/UITooltip.cs:117)
    TDTK.UITowerSelect.OnHoverUpgradeButton (UnityEngine.GameObject butObj) (at Assets/TDTK/Scripts/UI/UITowerSelect.cs:74)
    TDTK.UITowerSelect.OnUpgradeButton (UnityEngine.GameObject butObj, System.Int32 pointerID) (at Assets/TDTK/Scripts/UI/UITowerSelect.cs:89)

     
    Last edited: Sep 12, 2020
  48. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,656
    @Niroan, I've pm you the fix.

    @Gugaru, I'm aware of the fact that the documentation is lacking in term of coding API. The truth is documentation is not my strong suite and I don't really have the time and resource to do it. And given my past experience of not many user really need it, I hope you can understand why I decided to just leave it at that. Having said that, I'm always happy to help you to understand the code and point out the information you need to do any of the customization. You can contact me in private (email or private message) if you have any questions.
     
    Niroan likes this.
  49. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    52
    It worked thanks!
     
  50. YevgenG

    YevgenG

    Joined:
    Oct 17, 2018
    Posts:
    10
    Hello, guys! @songtan Was thinking about possibility to create various debuff effects, experimenting a bit but without a success.
    For example, debuff for a chance to be affected by a critical hit. I've tweaked Ctitical Reduc. chances in the Effects and give this effect as a one for Slow tower. Is it possible to be working this way? Or it even isn't supposed to work in this way? :)
     
unityunity