3:50 Vector3 is a struct (value type), it's instances as a local variables do not produce heap allocations. This code is perfectly performant. By caching the value in a field you actually made it worse, because that way you've permanently reserved X bytes of memory that a Vector3 takes + it takes more time to write a value from stack to somewhere in a heap.
@mehmedcavas3069 Жыл бұрын
yes!! was about the comment the same thing. creating a struct in a method is just shifting the stack index a bits all. but changing the value in the heap memory takes more process. as far as I know
@itsbarbaric Жыл бұрын
Indeed, doing this for a class would make sense of course :D
@dertobbe11766 ай бұрын
I am grateful for comments like this. I am not a Software expert in any way. Just a dude making his own game. Like a piece of Art. Input like this makes it easier to keep things organized. So thank you
@Gears2Game2 жыл бұрын
man, I don't remember that I unsubscribed from your channel until now., so that's why I am not seeing your videos anymore. I just resubscribed, I have always followed a system I heard once from you in my gamedev journey. it made me able to produce games easily. Thanks for that. I learned that the game development space is huge specially going solo and indie. I just have to pick one hat, learn it,be good in it. then everything else outsource, outsource, outsource.
@clamum96483 жыл бұрын
Excellent video man, with very clear explanations. Thanks game developer gangster man
@eliorubenmc2 жыл бұрын
I'm back to say: the gameplay of my game uses about 5ms cpu average before, and doing almost everything I see in this video and what I read in the blog, now it is 3ms cpu, and now run smoothly as never before... Still need to optimize my textures and all materials but this information is gold!!! Thanks again!! By the way ma game is "escape from marble's monster" very early development process is you are curious, there is only 3 videos about on KZbin
@TYNEPUNK3 жыл бұрын
good tips, I didnt know about the transform one! :o
@ali_kara3 жыл бұрын
Good tips thank you!
@nihil752 жыл бұрын
Great tips man, good to get some code focused suggestions beyond the usual "bake your lights, change to vertex" stuff (which is useful as well ofc)
@shiv-iwnl81883 жыл бұрын
The new unity logo is nice
@marcoseliasmep Жыл бұрын
Nice tips! I would never imagine that just calling transform.something would be bad for performance. I use it in many places, many times, for vehicles and pedestrians. I’ll check it later with a cached variable. By the way on the last thing you mentioned I don’t think it would be great. How are you loading those prefabs? If you place them inside a Resources folder that could slow down the startup of the app. I do prefer using asynchronous scene loading (sometimes additive, sometimes not).
@bhautikranpara76643 жыл бұрын
Very knowledgeable tutorial we want more like this
@cyrusshepherd49023 жыл бұрын
Yeah
@diliupg3 жыл бұрын
what is up guys? Fantastic tips! 100%!
@TacticalAssaultOfficial Жыл бұрын
Cool video! Thanks for the tips. You mentioned you used the profiler to find that specific line of code that was eating up performance. Do you have any videos on how to read the profiler to narrow down lines of code like that?
@reaporofdragon744 Жыл бұрын
in the Unity script at the top you add using using UnityEngine.Profiling; Profiler.BeginSample("Name"); //Your Code Profiler.EndSample(); and it would show the Name in the Profiler
@Kathayne6362 жыл бұрын
Great tutorial!! (BTW @2:20, you were correct in saying "latter". )
@supertenchoo42713 жыл бұрын
great video
@bindum71783 жыл бұрын
The One dislike is from an empty callback function...
@raploky2 жыл бұрын
Wooooow - that is extremely useful tutorial! Thank you a lot!
@nihaanali77193 жыл бұрын
Very informative
@stephenkentperez77052 жыл бұрын
those empty call backs was an "oh shit" moment for me... i recently shipped an mvp game demo with 200+ scripts that mostly have those empty callbacks...
@carlabalos38842 жыл бұрын
Great tips man. Thanks!
@thehyper42883 жыл бұрын
What a quality video, nicely done man.
@eliorubenmc2 жыл бұрын
genial, gracias!!! also the blog is en mis favoritos como referencia!
@mahmoudelboshy4033 Жыл бұрын
YOU ARE A GREAT MANNNNN!!!
@chamssidinechams4222 Жыл бұрын
great video thank you
@Jimaniki2 жыл бұрын
Thanks you !
@ADifferentGamingChannel2 жыл бұрын
Do you recommend using the Async Library instead of the Coroutine stuffs? I like your web btw :D
@regys95213 жыл бұрын
Amazing tips
@greekdevtutorials2 жыл бұрын
Amazing!!!!!!!
@notagamedev54943 жыл бұрын
More Optimization Tips And Tricks blog link is broken
@itookaonabookanyway73852 жыл бұрын
My simple toon shader Unity game that uses only 20 MB to install and run performs horribly, any tips for having a toon shader run on URP? or a toon shader that is best for mobile experiences I will refine my code again for the sake of optimization because I really need to make my game work efficiently on the phone
@shinronitgaming4863 жыл бұрын
How AAA studios are creating huge world games for mobile? Without any performance issuses? Like if i put a empty terrian in my scene with nothing at all more than a camera the fps goes 60 to 20-24
@diliupg3 жыл бұрын
reduced draw calls, LOD, URP, ;-)
@random_precision_software3 жыл бұрын
I'll hold my hands up,I make 99% of everything public is that bad or should I see the light and start to use serializefield ?
@clamum96483 жыл бұрын
The problem with Public variables is you can modify them in other objects you don't really intend to and the results can be unexpected and possibly hard to track down. You're free to do what you want, but I highly suggest you make everything Private by default and if you need it in the Inspector put SerializeField on it. It's just a good habit to get into. There's a reason this is stressed to programmers. It was drilled into our heads in my intro Computer Science classes in college.
@random_precision_software3 жыл бұрын
@@clamum9648 yea, I'll start doing it,I was self taught so have loads of bad habits lol
@clamum96483 жыл бұрын
@@random_precision_software It's all good, we're always learning. I definitely am no expert myself. I've worked professionally for about 13 years doing software development and the best developers I've worked with have a genuine passion for software development and continually try to better themselves and learn new skills, often working on their own personal projects here and there. Good luck bro
@random_precision_software3 жыл бұрын
@@clamum9648 thank you. 👍
@Eckster3 жыл бұрын
When coding by yourself on a short-term project you'll likely never run into issues, encapsulation (making things private where you should) matters a lot more in team settings and larger projects where limiting the scope of what state can be updated by external methods and by what means makes it a lot harder to step on each other's toes, and on your own toes on accident.
@reaporofdragon744 Жыл бұрын
I used the profiler to check how much my scripts are using in my 2D game and its 0.01 the game is running on 800 fps on pc and 300 on my old Pentium 4 laptop but its running 20 fps on my phone XD
@TalhaRiaz1973 жыл бұрын
Can we get you Games Link or your Id Link Please
@animationart57553 жыл бұрын
dude would u make an awesome tut about implementing a stamina script into mobil touch script. 2 days and it stil not work how it should work i red every articel and did every tut about it but nothing worked for me for them it worked not for me though so please help me a little
@Pixelsheartstudio Жыл бұрын
you make the same mistake when you did " Vector3 temp = mainCam.transform.position;" I`m just kidding ... really thanks a lot about your effort this helps a lot keep it up ☺️
@mussabrafiq5698 Жыл бұрын
Nice pic dear
@4xh93 ай бұрын
mu bro 🔥🤍
@syluxdev3 жыл бұрын
The most important thing is you can copy the code 😂
@dakshsharma29633 жыл бұрын
Today's video without intro 😮😮😮
@s6huskic303 жыл бұрын
Please make a game 'where is third gentleman?'
@awesometuts3 жыл бұрын
😂😂😂😂😂😂😂😂
@Area_GnC2 жыл бұрын
Yandere Dev should watch this video.
@abdulahadtayyab738410 ай бұрын
worst tutorial I 've ever seen just he was beating about the bush