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 Жыл бұрын
True facts 👍🏻
@markorossie9296 Жыл бұрын
Please that sounds very useful. Please consider make a tut of how. Thanks
@FyresGames Жыл бұрын
Totally agree. I use SO as middle man for my events and it work great!
@steveszymczak4485 күн бұрын
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 Жыл бұрын
I went through your tutorials and it was so helpful that I decided to buy your course to support you.
@RootGames Жыл бұрын
Thank you very much! I really appreciate it ❤️
@Soundy777 Жыл бұрын
Straight to the point, concise & informative! Brilliant explanation!!
@RootGames Жыл бұрын
Thank you! 😉
@motero2k Жыл бұрын
I really like your videos. This video is short but very useful. Awesome!
@RootGames Жыл бұрын
Thank you! Glad you like them, more to come!
@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 Жыл бұрын
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 Жыл бұрын
@@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.
@benjamingerd47032 ай бұрын
@FyresGames I agree, in most cases, that is a better way to do this!
@richardrothkugel81319 ай бұрын
ISubscribe. You got me.
@benjamingerd47032 ай бұрын
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 Жыл бұрын
really cool !! Very useful ! Thanks
@RootGames Жыл бұрын
Thanks Spinola!
@stbnsnt10 ай бұрын
Good! But it’s better to place OnTrigger event inside player
@RootGames10 ай бұрын
Yes, you also do that! 😉
@NoobProMaster01 Жыл бұрын
Can you make a tutorial for ground enemy chase trigger?
@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 Жыл бұрын
quee bien
@RootGames Жыл бұрын
Thank you! 😉
@haha-m2w Жыл бұрын
why doesn't my vs code report an error when not implementing the interface? should I type it down for each class?🥲
@dbrikashabukshan86733 ай бұрын
Yes, but you could very easily create a template script to copy-paste and edit as needed