Core comes with a built-in system of resources. A player can gather a lot of different resources in your game. Some basic objects are already created in Core so you don’t have to code to get started with this feature. Resources can be used as coins, gems, stones, or any kind of resources in your game.
This object is an item that can be gathered by the player when colliding with it. By default, it will add 1 resource of type “Gems” to the player. This is defined in the Custom Properties of the Resource Pickup object. The HealthChange value is useful to heal the player when they grab the resource, that is the easiest way to make a medkit in your game! You can also define a MaxResource amount and a PickupEffects that will be spawned when the player gathers the item.
In the Hierarchy, you will find the Trigger that detects the player, the script that gives the resource to the player, and a Geo_ClientContext folder containing the model of the resource, here, a gem. To change the model of the resource, remove the gem and add another asset in the Geo_ClientContext folder.
Try it on Core! Add 5 coins that you can gather by walking on them. The resource should be called “Coins” and not “Gems”. Coins will disappear when colliding with them.
The Resource Display is showing the amount of a specific resource for the current player. In the Custom Properties, you must define the ResourceName with the same value as the one you set in the Resource field of the Resource Pickup object. If AlwaysShow is disabled, the popup is shown during the number of seconds defined in the PopupDuration.
The UI can be updated in the ResourceDisplayContainer. You can change the Background, Icon, and Text aspects. If you want to move the whole thing at another place of the screen, update the Panel object. Use the Dock and Anchor properties to make a UI that can adjust to any display. For example, if you want your resource to stay at the middle bottom of your screen, set the Dock property to Middle Bottom. Now, try to change the width of the viewport, the Panel will stay in the middle.
Try it on Core! Add a Resource Display object to your scene that shows the resource “Coins”. Update the Icon and use a coin icon instead of the coin bag.
Strictly Necessary Cookies
Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.
If you disable this cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.
3rd Party Cookies
This website uses Google Analytics to collect anonymous information such as the number of visitors to the site, and the most popular pages.
Keeping this cookie enabled helps us to improve our website.
Please enable Strictly Necessary Cookies first so that we can save your preferences!