Learn INTERFACES in 5 minutes | Unity

  Рет қаралды 5,397

Root Games

Root Games

Күн бұрын

Пікірлер: 27
@PoisonedAl
@PoisonedAl Жыл бұрын
Once you learn Interfaces and Events, life gets a lot simpler and your code WAY cleaner. Get scriptable objects in there too and you can remove a lot of your dependencies.
@RootGames
@RootGames Жыл бұрын
True facts 👍🏻
@markorossie9296
@markorossie9296 Жыл бұрын
Please that sounds very useful. Please consider make a tut of how. Thanks
@FyresGames
@FyresGames Жыл бұрын
Totally agree. I use SO as middle man for my events and it work great!
@steveszymczak448
@steveszymczak448 5 күн бұрын
I have become event pilled recently, occasionally use scriptable objects but still don't understand their use cases to a complete degree, right no trying to dig into interfaces
@ThanhNguyen-gj1pm
@ThanhNguyen-gj1pm Жыл бұрын
I went through your tutorials and it was so helpful that I decided to buy your course to support you.
@RootGames
@RootGames Жыл бұрын
Thank you very much! I really appreciate it ❤️
@Soundy777
@Soundy777 Жыл бұрын
Straight to the point, concise & informative! Brilliant explanation!!
@RootGames
@RootGames Жыл бұрын
Thank you! 😉
@motero2k
@motero2k Жыл бұрын
I really like your videos. This video is short but very useful. Awesome!
@RootGames
@RootGames Жыл бұрын
Thank you! Glad you like them, more to come!
@FyresGames
@FyresGames Жыл бұрын
It is indeed a way to do it, but what about going the other way around? You could put the OnTriggerEnter and Exit only once onto the player. When its in range of a trigger, set a bool _canInteract to true and _interactable = other.GetComponent(); (Set back to false and null in exit).
@RootGames
@RootGames Жыл бұрын
Yes you also do it like that. Just note that then you lose some flexibility, because your collider for detecting interactables is always the same (on the player). In the way shown in the video, you can customize the colliders for each object as you wish/need.
@FyresGames
@FyresGames Жыл бұрын
@@RootGames Oh no forgot to say the collider trigger is still on the objects. The main difference is instead of each objects getting the player component and sending their IInteractable to the player, the player get it itself.
@benjamingerd4703
@benjamingerd4703 2 ай бұрын
@FyresGames I agree, in most cases, that is a better way to do this!
@richardrothkugel8131
@richardrothkugel8131 9 ай бұрын
ISubscribe. You got me.
@benjamingerd4703
@benjamingerd4703 2 ай бұрын
0:20 "If you don't use interfaces, your code would look sth like this". I don't think it would, bc the code you show would require the chest, door and crabby components to be on the player, which is unlikely. Also, in most cases, it would be better to place the collision detection with the IInteractable on the player, rather than having the chest, door, etc store a reference to themselves in the player.
@gamesbyspinola
@gamesbyspinola Жыл бұрын
really cool !! Very useful ! Thanks
@RootGames
@RootGames Жыл бұрын
Thanks Spinola!
@stbnsnt
@stbnsnt 10 ай бұрын
Good! But it’s better to place OnTrigger event inside player
@RootGames
@RootGames 10 ай бұрын
Yes, you also do that! 😉
@NoobProMaster01
@NoobProMaster01 Жыл бұрын
Can you make a tutorial for ground enemy chase trigger?
@RootGames
@RootGames Жыл бұрын
I'm in the middle of creating a new course. Did you watch my flying enemy tutorial? It may give you an idea of how to do it.
@zeusdelolimpo2882
@zeusdelolimpo2882 Жыл бұрын
quee bien
@RootGames
@RootGames Жыл бұрын
Thank you! 😉
@haha-m2w
@haha-m2w Жыл бұрын
why doesn't my vs code report an error when not implementing the interface? should I type it down for each class?🥲
@dbrikashabukshan8673
@dbrikashabukshan8673 3 ай бұрын
Yes, but you could very easily create a template script to copy-paste and edit as needed
Fix Visual Studio Autocomplete in Unity
1:24
Root Games
Рет қаралды 6 М.
World’s strongest WOMAN vs regular GIRLS
00:56
A4
Рет қаралды 48 МЛН
When Cucumbers Meet PVC Pipe The Results Are Wild! 🤭
00:44
Crafty Buddy
Рет қаралды 56 МЛН
ТВОИ РОДИТЕЛИ И ЧЕЛОВЕК ПАУК 😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 5 МЛН
How to do Visual Scripting in Unity!
16:18
TheKrazyDev
Рет қаралды 47 М.
The Power of Scriptable Objects as Middle-Men
17:41
samyam
Рет қаралды 129 М.
What are Interfaces? (C# Basics)
13:54
Code Monkey
Рет қаралды 212 М.
SCRIPTABLE OBJECTS and EVENTS in Unity
6:46
Root Games
Рет қаралды 6 М.
Using Interfaces in Game Development (Unity Tutorial)
7:00
Infallible Code
Рет қаралды 90 М.
Godot Scripts I add to Every Game
12:34
Aarimous
Рет қаралды 44 М.
Rethink Everything with Scriptable Object VARIABLES
15:28
Using Interfaces in Unity Effectively | Unity Clean Code
4:23
James Makes Games
Рет қаралды 62 М.
World’s strongest WOMAN vs regular GIRLS
00:56
A4
Рет қаралды 48 МЛН