Search
  • Nathan Tubb

My Project 2: Resource Gathering

Updated: Apr 30, 2021

Being able to gather resources for crafting is a major part of the game as without it the player would not be able to get the gear needed to help them fight the undead and complete some of the challenges.


Resource gathering works through players using the correct tools on certain elements within the environment such as trees and mineable rocks. The system works by detecting hits and then checking and returning the appropriate resource from that item (amount based on the tier of a tool).

Once a resource has been used up, it will be destroyed, dropping extra items on the ground for the player to pick up, in some cases these items are different from what the player can get by simply harvesting the tree.


A big issue I faced with this system was during level creation and the use of Unity’s tree painter terrain tool. Whilst painted trees are automatically given colliders, they do not carry over any script or other data from their prefabs. After researching the problem I came up with the following solution for the problem, which takes all the trees saved in terrain data at start, and allocates them with a prefab tree collider that also contains the appropriate resource scripts.

In the future more resources will be added to gather such as bones from zombies and perhaps ingredients from certain plants.


Thanks for Reading!

2 views0 comments

Recent Posts

See All