Пікірлер
@Mannavard88
@Mannavard88 11 күн бұрын
Man, u've create nice content, sad to see that channel is abandoned :(
@JamesMakesGamesYT
@JamesMakesGamesYT 11 күн бұрын
Not abandoned, just on hiatus!
@Mannavard88
@Mannavard88 11 күн бұрын
Thank you, very clean and useful explanation with examples
@moeingharib6857
@moeingharib6857 17 күн бұрын
this was the most comprehensive, simple and useful video I've seen in months..
@JamesMakesGamesYT
@JamesMakesGamesYT 16 күн бұрын
Thanks for the kind words, glad this video was helpful
@PedroBoris-ws6ks
@PedroBoris-ws6ks Ай бұрын
Thank you so much it's so easy and help me a lot of in my project
@JamesMakesGamesYT
@JamesMakesGamesYT Ай бұрын
No problem! What project are you working on?
@PedroBoris-ws6ks
@PedroBoris-ws6ks Ай бұрын
@@JamesMakesGamesYT horror game
@JamesMakesGamesYT
@JamesMakesGamesYT Ай бұрын
Oh yeah, the night vision will work really well with that! Best of luck!
@eloreneloreneloreneloreneloren
@eloreneloreneloreneloreneloren Ай бұрын
Depth of field will ruin performance
@JamesMakesGamesYT
@JamesMakesGamesYT Ай бұрын
Yeah, that’s a good point some post processing effects can lower performance. It can be something you use sparingly, like for cutscenes, or you can try to improve the performance elsewhere. Thanks for the comment!
@valleriandicque9282
@valleriandicque9282 2 ай бұрын
Try to guess "Demeter" Stardew Valley lol
@omar-0082
@omar-0082 2 ай бұрын
thanks you so much but i have a dumb question, can I add multiple functions into one interface or i must avoid that? Anyway tanks you very much !
@Ifjdjojdjxoxlsh
@Ifjdjojdjxoxlsh 2 ай бұрын
what if i have other post effects, will it turn those off too
@JamesMakesGamesYT
@JamesMakesGamesYT 2 ай бұрын
I think if you create a separate post processing profile for general effects and night vision, then they wont affect each other
@Ifjdjojdjxoxlsh
@Ifjdjojdjxoxlsh 2 ай бұрын
@@JamesMakesGamesYT oaky thanks
@NewUser78654
@NewUser78654 2 ай бұрын
The main mistake of the author of this video, as well as others like it, is that they consider the state machine as a tool for setting the state. But one should use a state machine as a tool for determining (!) the state of an object. Yes, there is a tricky definition of a state machine, but who reads all this... That is, describe all the states of an object, determine them and, based on the state of the object, execute methods. More complex projects may have more than 1 state machine. The second mistake many authors make is to copy the animator’s unity ideology. They argue that an object must change from one state to another. For example, from waiting only to running. Apparently they forgot about the wonderful animator's hell, which everyone has already said 1000 times. Modern animation programs don't have any states. You can call any animation from code. Just like in Unity, but we love states - arrows, entanglements....? And finally. Multiple returns in code. We moved away from multiple ifs to returns. And to empty return. And, according to the idea, return should return something - that’s what it was invented for, but no, we use it as an analogue for stopping the execution of a method. Also multiple returns are not very good architecturally. Since we have 1 entry point into the method and 10 exit points from it. There are other problems with this approach, but I probably won’t describe them...
@Ryöken17
@Ryöken17 2 ай бұрын
It's cool in a way, but there is a priority, can't you have an if and a print depending on wich one triggers ?
@Sciaining
@Sciaining 2 ай бұрын
Thank you for this tutorial, it was really helpful! Though this makes me wonder: is the interface only accessible to the script that defined it or is it accessible from any script? And if it isn't, how can I for example make an object damageable by different objects (and not just the player)?
@JamesMakesGamesYT
@JamesMakesGamesYT 2 ай бұрын
You can get an interface from any script using the GetComponent<T>() method. The method is accessible on all game objects so you can call it on a collider if you raycast or collide with an object for example
@Sciaining
@Sciaining 2 ай бұрын
@@JamesMakesGamesYT Thanks!
@rubenbarrosogarcia611
@rubenbarrosogarcia611 2 ай бұрын
Amazing explanation
@JamesMakesGamesYT
@JamesMakesGamesYT 2 ай бұрын
Glad it was helpful!
@grivlixyt875
@grivlixyt875 2 ай бұрын
what if you have a special attack for example when ur sprinting and jumping? how would you fit that into this structure
@JamesMakesGamesYT
@JamesMakesGamesYT 2 ай бұрын
Good question. I think for something like this scenario, the ordering of guard clauses would be the solution. So the first guard clause would check if both sprinting and jumping are true then after that have two separate guard clauses for sprinting and jumping. Hope that makes sense
@ReafEfil
@ReafEfil 2 ай бұрын
The animation not working if there is math in them is very true! And I'm one of them who use time scale, i created.. was it if statement to check if the time scale is above 0 then the math is done and if less it will stop calculating so the animations wont brake. definitely i crate a small test to see this out !
@zanagi
@zanagi 3 ай бұрын
wow i was almost going crazy trying to understand from other source. thank you so much
@AtomicDurpYT
@AtomicDurpYT 3 ай бұрын
I can't begin to tell you how much this has helped me, Thank you.
@JamesMakesGamesYT
@JamesMakesGamesYT 2 ай бұрын
I’m glad this video helped you!
@NeoAArmy
@NeoAArmy 4 ай бұрын
So, with mine, It somewhat works. The keybind works, etc etc. shows green in editor, HOWEVER, When actually playing on that map, pressing N doesn't make the camera lens go green, it just brightens up the world a little. Any reason on why? nvm I broke it even more, upgraded to urp and it doesn't even show anything now.
@JPsonicACE
@JPsonicACE 5 ай бұрын
that was really usefull and clear , im just not sure .. where do you write the Interface - > public Interface Idamageable { void damage(amount) }
@JamesMakesGamesYT
@JamesMakesGamesYT 2 ай бұрын
You can create an interface in a new file like you would creating a new script
@BFBStudio
@BFBStudio 5 ай бұрын
Great Video!
@pistolerointergalactico9019
@pistolerointergalactico9019 6 ай бұрын
Perfectly explained fast and clear
@der-Dritte
@der-Dritte 5 ай бұрын
Better than offical unity video
@skurt6005
@skurt6005 6 ай бұрын
Thank you! This tutorial really helped me, and I appreciated how quick you went through with this one. I really didn't want to use Timescale as it felt like I wouldn't have any control.
@Wishbone_Games
@Wishbone_Games 6 ай бұрын
This saved my life
@JAKEAVALON-rg8xm
@JAKEAVALON-rg8xm 7 ай бұрын
why you need to write all of them when you can just write in 1?
@haliesnailie4541
@haliesnailie4541 7 ай бұрын
this video explains interfaces better than my college classes lol
@HansonJ
@HansonJ 7 ай бұрын
GetComponent can retrieve Interfaces? I thought it could only grab actual components, makes the name misleading.
@DisturbedNeo
@DisturbedNeo Ай бұрын
Initially, it did only retrieve components, specifically anything that inherited from UnityEngine.Component, hence the name. But in 2014, the method was updated to take better advantage of C#'s generics, and now it can retrieve any type that is, inherits from, or implements the target type. The name has remained the same for backwards compatibility reasons.
@risingdagger5416
@risingdagger5416 7 ай бұрын
this is good but how do i check if the collision is not in play, because I'm using a boolean in my code to check if the enemy is grounded or not using this interface method
@ELEC7RO
@ELEC7RO 7 ай бұрын
I will just use events in tandem with time scale. Even more control and efficiency.
@Johan-rm6ec
@Johan-rm6ec 8 ай бұрын
Thank you for not using the word C.O.N.T.R.A.C.T. once!!!!
@simoncote4064
@simoncote4064 6 ай бұрын
he did tho twice XD at 2:30
@JamesMakesGamesYT
@JamesMakesGamesYT 2 ай бұрын
I actually like the contract analogy but I think it gets misused. When you write up a contract with someone, for example a plumber, the contract doesn’t say “you will be a plumber” it says “you will do the following plumbing tasks” Again it comes back to the “what you are” vs “what you do” example from the video
@shinryusaiha
@shinryusaiha 8 ай бұрын
To the nay sayers in comments, this is how you are supposed to pause. Dont be lazy and sloppy take your time to make your game right. Events are efficient and performant and this removes any bugs with pausing from the various other lazy methods.
@richie4956
@richie4956 8 ай бұрын
This might seem like a stupid question, but what are you doing in this line? EnemyTarget target = hitInfo.collider.GetCompoment<EnemyTarget>(); is this a way to create an instance of a variable from another class? What is is required to do this? I understand the rat cast part I am actually only confused about the declaration of target
@PUNCHLER
@PUNCHLER 2 ай бұрын
i think he is caching the target object to make his life easier
@fv4202x
@fv4202x 8 ай бұрын
I could do this with sub classes. Interfaces just makes things a little bit longer. Then why are they exist? I never felt like I really need interfaces.
@erikberg2893
@erikberg2893 8 ай бұрын
He goes over that in the video. You're only able to inherit from one class. What if you want to give your class more functionality after the you you make the subclass to work with another system you already have in place?
@fv4202x
@fv4202x 8 ай бұрын
@@erikberg2893 I changed my mind thank you
@SalarianStudios
@SalarianStudios 9 ай бұрын
damn such a great explanaition. definetely deserves a sub. thank you so much man :D
@theemeraldend4302
@theemeraldend4302 9 ай бұрын
Thank you, I am currently making something where the player can move in 2d, but needs to interact with stuff and need something that allows them to interact with a button without knowing what the interactable object does
@klausbdl
@klausbdl 9 ай бұрын
i doubt u can come up with a dev name for Portal or Portal 2 lol
@JamesMakesGamesYT
@JamesMakesGamesYT 9 ай бұрын
Tricky one! How about Hermes - God of travelling?
@bernardo231
@bernardo231 9 ай бұрын
"find a script that will be affected by pausing" - like almost all of them? Do I need to put all this amount of code in every script that is affected by pause?
@reyou7
@reyou7 9 ай бұрын
You are actually teaching here how to create a singleton and use delegates and events. This is not a tutorial of "better pausing technique" in Unity.
@Souloutions
@Souloutions 10 ай бұрын
Doesn't work, tried to make it work with many and many changes but nothing
@johnnyfatsacks5209
@johnnyfatsacks5209 10 ай бұрын
I never fully understood interfaces and this perfectly explains it. Thanks.
@darkmattergamesofficial
@darkmattergamesofficial 10 ай бұрын
This is incredibly helpful. Thank you!
@byram_brt
@byram_brt 11 ай бұрын
code link cant open :(
@byram_brt
@byram_brt 11 ай бұрын
i cant reach code links
@thedrumminggamer1064
@thedrumminggamer1064 11 ай бұрын
this was an amazing explanation, i already used and fully understood interfaces, but this helps increase the Modularity of code , which decreases time to add new features, and removes dependency within code , which can then further be boosted by the observer method
@scull3208
@scull3208 11 ай бұрын
I can't express how much this 4 minute video has helped me. Thanks so much!
@jarrettonions3392
@jarrettonions3392 11 ай бұрын
Thank you. Implemented... wow.. so much easier than the jumble i was working with. Great, consise, easy to follow tuturial.. and exaclty what i wanted and how i wanted it to work. Damage ammount on the thing that actually does the damage... then health on the thing that actually looses health... so simple.. no of these weird incorrectly placed and refenenced tangles
@Seshua87
@Seshua87 Жыл бұрын
I thought I was watching a tutorial Little did I know it was actually a speedrun.
@PeetHobby
@PeetHobby Жыл бұрын
But watch out, often clean code is very slow code, sometimes even many times slower.
@wa1gon
@wa1gon Жыл бұрын
That is a good start. I would also add that all the if should be extracted to a guard method that returns a tuple (bool isAttackable, string message) = CanAttack(..); Methods must only do one thing. This one is doing two: 1. checking to see if you can attack, then if you can then attack. This makes the code much more testable.
@EnricoDias
@EnricoDias Жыл бұрын
Better yet, use chain of responsability. A list of classes implementing the same interface, each one checking for a specific condition. The method walks the list of classes before performing the action and returns early if any of them fail. That way you just need to add a new entry to the class list when adding a new restriction, leaving the original method untouched.
@pmoneyish6869
@pmoneyish6869 7 ай бұрын
This is interesting. The question I have around this would be how is each condition class getting the data to do the checks?
@TripleCreeper3
@TripleCreeper3 Жыл бұрын
i understand it now, you are a beast
@johnsartain4160
@johnsartain4160 Жыл бұрын
I'm still not sure if I need to be using interfaces or a base class on my current project