Add an Interaction System to your Game - Top Down Unity 2D #16

Опубликовано: 23 Март 2026
на канале: Game Code Library
21,138
485

Let's add interacting with in game objects of any type to our game! We'll add opening chests as our interactable object example, which will spawn an item and stay opened after saving our game. We'll use a collider to trigger when interactable objects are in game, then use Unity's Input System to know when our player has pressed the interact button!

You can follow the full playlist 🐸 to complete the full top down base template
Full Playlist:    • Top Down Tutorial Series - Unity 2D  

Get the code:   / add-interactions-121505137  
Download the Top Down Template🐸: https://gamecodelibrary.itch.io/top-d...

Sprite sheet: https://pixel-boy.itch.io/ninja-adven...

All source code for all videos I have made and will make in the future can be found on my Patreon:
  / gamecodelibrary  

Be sure to subscribe to see what kind of adventure we can go on together! I'm excited! :-)

If you have any suggestions, feedback or questions, be sure to comment below! Any opinions will help me out on this journey ♡

Check out the full platformer playlist!
   • FULL Platformer Tutorial Series - Unity 2D  

BUY THE COMPLETE PLATFORMER GAME TEMPLATE NOW!!!
https://gamecodelibrary.itch.io/2d-pl...
  / shop  

#unity #gamedev #gamedevelopment #unity2d #topdown

0:00 - Intro
0:39 - Chest GameObject
2:00 - Interactable Interface
3:06 - Chest Script
4:51 - Global Helper
6:03 - Chest Script
8:54 - Interaction Detector
10:19 - Interaction Detector Script
13:21 - Interaction Detector Setup
13:30 - Chest Setup
14:04 - Interaction Input
15:25 - Working Test - Open Chest
15:55 - SaveData Script
16:48 - SaveController Script
20:10 - Working Test - with Save!
20:36 - Delete Save Data
21:12 - Broken Inventory Fix
22:41 - Icon Disappear Fix
23:16 - FINAL Test!
23:37 - Get the Code
23:58 - Next Video
24:10 - Outro