We are happy to provide this Tower Defense template project and written manual for intermediate users to take advantage of. This project is designed to be learned from, extended, repurposed - whatever you like!
Download the project here -
Manual is here -
We hope that it makes for a great start for anyone wishing to tackle the Tower Defense (in 3D) genre and we look forward to hearing your feedback on this project and it’s manual. Please post any feedback you have here and we will endeavour to respond.
Known Issues
There is a bug in Unity 2017.3 that gives the following error -
“Assertion failed: Transform has SetIsHierarchyDispatchInterested present when destroying the hierarchy. Systems must deregister themselves in Deactivate.”
This is nothing to worry about and only occurs when you exit play from trying out the game. This error can simply be cleared in the console and it is fixed in 2018.2 so should never give you any problems.
In the “Creating an Agent” section, "Add an AttackingAgent or FlyingAgent component to the GameObject". I try to do this with both AttackingAgent & FlyingAgent scripts but I can’t do it because I get the following error:
“Can’t add script behavior ILauncher. The script class can’t be abstract!”
brilliant i must say, one of the best packs that i have seen out there. totally a 5 stars quality.
as an intermediate student learning unity, i’d say that, i wouldn’t really use the template myself. what im doing is pick up a system or two from it, and do my best to deconstruct them and find out how they were built.
and so i did. i must say, the code’s quality is top notch, in my intermediate eyes, it is totally professional looking code.
however, if its not trouble, but i’d like to ask, when you guys made this project (template) did you guys make some sort of Technical/Code/System design document, or something along those lines? (especially for the Core Frame Work)(if these are aviliable for other frame works too i wouldn’t say no )
i know its probably a lot to ask, but if you can or have something along those lines, it would be cool if you guys share it.
(the documentation is nice and all great and very detailed too, but its more in the lines of “how to use the template” and what i am hopping for is “the code plan/system design document type of thing”)
sorry for the not so great english
as i am taking this project for more of a learning trip rather than a usage trip. so anything that helps me deconstruct the code, and draw the structure in my mind, would be a great.
Hi @willgoldstone , the project is amazing indeed! Everything is very well written and commented (classes, functions, variables, etc.), but as @GrassWhooper said it would be great if there is some supporting documentation that gives some sort of an overview of the Core Framework - everything there looks well abstracted and reusable.
Will the Core Framework be available as a separate package on the Asset Store? Also what is the license for it in terms of modifying and extending classes and using it in a commercial project?
Hi there, not solidified any plans as to separating the Core Framework as yet - but I can say that this and any other part of what we release here can be used in a commercial project.
Hello there,
first of all, this sample project looks really good and it’s a real fun. However, I’m really suprised that anyone didn’t found a bug that is 100% reproducible for me and that makes game unplayable on android.
Build for android, play on device
Start a level, start building a tower
When you tap on a location (or drag) tower is positioned correctly, fine
Try to tap on V (accept) button - surprise, button is not tapped, instead tower has moved in the place you have tapped. You can try to repeat it many times, for me it was impossible to place any tower.
After some digging, I found that there is check for pointer being over UI, however in UpdateTouches() method (InputController.cs:322):
startedOverUI variable returns false, even that I’m tapping on a UI button. For me this code looked good.
Then for my bigger surprise I accidentaly found a way around this problem - if (on a device) you perform a really long tap instead of normal, short tap then the tower is builded correctly.
For now I have no idea how to fix this to work correctly in all cases.
Project builded from Unity 2017.3.0f3.
Tested on Samsung Galaxy S4 (4.4.2) and Xiaomi Redmi Note 2 (5.0.2), same behavior on both.
Just a quick question…First of all the project has been a blast to mess around with the last couple of weeks.
I’ve modified the agents scripts, to allow them to target towers and fire all of the time, which has worked quite well with the prefabs that came with the template.
However ,I’ve noticed a couple of odd things when making new agents and towers.
If I just try changing the 3d model associated with a tower and save the prefab with the new art applied (and yes I did change the settings in the affector and the targetter to the new model), the fire effect from the hit scan launcher never plays (or it never appears to be visible). I can see all of the other ones, and this also appears to be tru with the fire affect if I try making a new agent.
Everything else with them appears to work… the turrets appear to target… damage is applied to the target… just no fire effect anymore.
I also noticed that existing towers have an extra tasrgetter that just seems to appear in the hierarchy that can’t be copied… they disapear when dropping the prefab into a scene… and can’t be replicated in anyway I know of.
Machineguntower_0 has been saved by me after changing the model… both 1 and 2 show the extra targetter
I’ve also noticed that the fire Effect referred to in the hitscan launcher on the machine guns doesn’t seem to have a prefab…
I tried taking a look at it in an attempt to figure out what I was doing wrong, and it seemed to just reference the script I was clicking on rather than a particle effect… If I did double click on it however, it opened up a predefined set of particle effects. I thought I found what I needed… but, it turned out even though I could see the particle effect, there was no way to find it in the hierarchy or save it to a prefab… Any ideas on what’s up with this?
what files do i need to pick if i only want the models sounds particale and ui assets and no scripts or any other data… so i can put them in a seperate folder im getting confused by the amount of folders and i dont know what they are all for.
If that is what you want, simply look at the working scenes then drill down into certain game objects and select the models and prefabs assigned to them? not sure what to tell you but the folders should be appropriately named, it’s up to you to choose what you want from them.
Hi i’ve discussed this with the developers they’re going to take a look at it once we have a little more of their time hopefully next week or so, sorry for the delay.
In the Prototype scene there are obstacles. The cube obstacles have blue wireframe (gizmos?) grids on the top faces. How are these grids created/displayed?
Hello, nice tutorial but i stuck at very beggining when i need to add meshes:
"Let’s create a TowerLevel Prefab for the first level of our tower.
In the Hierarchy window, click on the Create menu and choose Create > Create Empty
Give the new GameObject a name to indicate its tower type and level (eg. LaserTower_1)
Add a TowerLevel component to the GameObject
Drag the ScriptableObject for this tower’s level into the Level Data field
Add meshes that represent the tower as children of the GameObject
Create a folder for the tower in Prefabs/Towers
Drag the GameObject from the hierarchy view into the newly created folder to make it a prefab"
Which meshes??
I bring ready Laser Tower prefab to see what meshes, but want to follow the tutorial which dont describe exactly what meshes are needed, also when i copy stuff from prefab my tower is white even if i put proper “LaserTower_L01_Albedo_V001” material…
So…which meshes exactly?? Wanna know if i choose right because when i choose those in models/tower laser1 it has animator component comparint to mesh from prefab and is white even with same as prefab material.
As i say i wanna only follow the tutorial i know how to get right prefab etc. again, only want to follow the tutorial.
Hi,
One question that is breaking my head, I want a turret made in the editor that can shoot the agents, all works fine, but when it have to shoot, the turret only look at the agent, it not shoot, do nothing, when the turret is made clicking the create button in the game, it shoots, but I want a turret created in the editor and when I click play the turret is there
Where I can see how the turret shoot?
hello thanks for making this template available.
I just wanted to ask if there is something like a video training for this template how to use it and work with it because right now i dont really know how to start.
I’ve used the tutorial to make my own scene which works outside of one bug. I’ve noticed that the agents do not shoot back now in ANY scene even though I did not modify the other scene.
I’m here because i found something strange in the template. The EMP tower, after been destroy, keep slowing the agents.
The “Slow Affector” attach a script (AgentSlower) to the agent in range, and will remove it if the target leave the Range.
The problem, as i mentioned, there is when the tower is destroyed while agents are still in range nothing in code will remove the AgentSlower script from them
If someone can help me using the “TargetsInRange” variable to solve the problem, please.
PROBLEM SOLVED
Create a list to keep track of agent you will attach the AgentSlower, and OnDestroy, call for each agent the RemoveComponent methode.