Unity memory leak

Share on facebook
Share on twitter

Unite Berlin 2018 - Memory Profiler: The Tool for Troubleshooting Memory-related Issues

6 320 views | 12 Jul. 2018


Slides: https://www.slideshare.net/unity3d/memory-profiler-the-tool-for-troubleshooting-memoryrelated-issues

Although Unity has good performance tools, it has traditionally been lacking in the area of troubleshooting memory-related issues. Finding leaking memory, biggest allocations, or just poking around to see what was happening has not been easy in the past. Come to this session to learn how the Memory Profiler aims to change that.


Grzegorz "Greg" Wojciechowski (Software Developer in Core - Kernal Team, Unity)


Ramjet Anvil

Fantastic work!


hi,i want this tool ,where can i get it?thank you.

Merciful Servant

Thats great.

Wenbin Pu

what's mean the native size? it's about 10X bigger than owned size.

Андрей Олейников

Great work ! I wanna it, fast as possible.

Unity memory leak

Share on facebook
Share on twitter

Memory Leaks (Super Basic) | Godot Basics Tutorial | Ep 21

1 201 views | 28 Jun. 2020

Welcome to the Godot

Welcome to the Godot Basics Tutorial Series, in this episode we take a soft and basic introduction into memory leaks and a brief look into object pooling (super brief, take a better look at it woads the end of the series).

Godot Tutorials


? Website:


? Twitter:




? Godot Game Engine Tutorial Series:


? GDScript Fundamental Tutorial Series:


? Trello Page with other Godot Channels:


In this episode we cover the following:

- Garbage Collection (Simple Terminology)

- Brief Look at Garbage Collection Advantages/Disadvantages

- Brief/Simplified Theory looking into Object Pooling (Object Pool Pattern)

Godot Tutorials aims to teach beginners how to get up and running with basic game programming skills.


I love that godot design tho, anyways liked the episode


About object/node-pooling, I'd point out, that _ready is not called when re-adding a node, and that the node is basically in the same state as it was, when it was removed -> Unless we also do some re-initialization this might lead to (for example) adding already dead enemies :)

Island Yan

hey DR .Godot Tutorials, i want to hide some object in my scene whrn camera far away ,how can i do is best? hide them? then set visable ,or load them when player near them?or other way?

Island Yan

cool ! though i can hardly understand ....but i think it's very important

Feniks Gamedev and Devlogs

As always great video I knew all of that yet I still found it clarified things in my mind more

Anderson de Matos

Now I first like your videos, and then I watch them, because I know the content is good.


When u added godot to the scene that made me laugh, that just made my day

Invader civic

Can you show an example in a project?

Any Key

Just download more ram.

Unity memory leak

Share on facebook
Share on twitter

Learn to Program with C# - DELEGATE & EVENTS - Advanced Unity Tutorial

66 534 views | 21 Dec. 2016

In this video we take a

In this video we take a look at using delegates and events for creating a callback system in unity! Also known as the observer pattern! For more information and in-depth knowledge of C# and Unity, check out The Unity C# Survival Guide, available at https://GameDevHQ.com



► Discord


► Subscribe






Want to learn to make games?

Unity C# Tutorial for Beginners - https://youtu.be/apJoi_YFVqk

Unity C# Tutorial Intermediate - https://youtu.be/MCrEhTHklsQ

Unity C# Tutorial Advanced Coding - https://youtu.be/p-KjunKkuJw


Have a tutorial suggestion? Send it to us on GameDevHQ.com.

Social Media Profiles

Facebook: https://facebook.com/gamedevhq

Twitter: https://twitter.com/gamedevhq

Website: http://gamedevhq.com unity 2018 tutorial

Artist's Journey

Looking forward to next video! Will you be making this code available, as singleton code is hidden? Thank you.

shonik 1121

10:12 you can lock Inspector, select all enemies and put them all into array together.

Alexander Yevsyeyev

Thanks, nice vid.


I always used Lists and Arrays and a ton of code to manage something like that...This is so much more convenient. :D

Thanks for the Tutorial

Gregory Fenn

So anoymous functions, lambda and func and action... ? I would love to see a video on that! It's been over two years waiting!!!

No Bytes

I've watched hundreds of videos on delegates and events, and you freaking broke things down and explained like a rock star! Thumbs up!

Marek Římal

What if I dont want it to be static?

Mehmet Çömlekçi

Your expression was good, I don't know English, but I still got it with automatic translation. Thank you for the video.


To add to this. Event are delegates basically. One main difference is that you can write yourdelegate = myfunctiontobecalled . which in many instances are incorrect as that might overwrite. Events only have += and -=.
Also event does not have to be static. Static event handlers can be a bit dangerous as there can much more easily be memory leaks that way. However, in many cases especially in regards to Unity a static event is prefered (that way you don't really have to find all the objects that will fire the events).


How do you do it without a singleton then?


I know how use delegates but I like you and your explanation method :)


hi GameDev!
Do you plan on making any more of these tutorials? They were super helpful to me!

Luke Nukem

Delegate works without System., which you show later.


More code... more efficiency? Ah last I checked delegates are not efficient. You did not compare with a system timer and execution of code so efficient claim doesn't stand up. I have used delegates before, almost no point unless you want to recycle a sub. Your video is great still but this is similar to comparing learn to write oop when the user's code doesn't even need oop, why use it? The example wasn't good enough, I wouldn't use it this way in all my years of programming. No negativity to you, partly my opinion too. Frankly you did a much better job explaining than most unity tutorials.


So, how do you input the argument of the parameter, if it requires it?

Lauris Tamo

Great tutorial :)

Paco Cu

Thanks bro! Very useful tutorial series, I learned a lot.

null pointer

Thanks A Lot!! Do you ever plan to do a series on advanced third person character controller?

Tyler Wallis

I watched this video for the second time and the Observer Pattern finally clicked for me. I immediately jumped into to replacing some horrendous code and it works so nicely now.

Michael- Angel

The only thing i have to say besides that this is one of the best tutorials about Delegates and Events in Unity is that I can really relate on the spam-save you are doing before every compile XDDD That's the exact same thing i always do.


You have an incredible feeling for explaining the mindset behind coding. Most of the time you need to dive in and experiment with it to really understand what it does. You are by far the best! Awesome to have you back!

Sajith Game

I was looking for week for this. Well explained. Thank you

Prof Hammond

nice cuts the video disrupting the flow, thanks rabbi.


Why not make the event static and then each enemy can access the event exactly the same way through Player.onEnemyHit += Damage; ??
Would that not save you having to make the player a Singleton?


danm bro your clean. i have a problem and my teachers dont really want to tell me how to use events because they say is too advanced. So here i am looking for solutions on my own.
I have a game where u can buy skins and buffs in the shop but im trying to link the buff let say u pay 300 coins for a new buff with more jump str to reach new areas ¿it is possible doing it like this? with events because im using playerpref to keep my data saved.

Prasetio Nugroho

actually I follow your tutorial from fundamental until advance, and i think your channel is a good place for developers to understand code in unity, keep the good work jonathan

Martin Edmaier

Awesome great explained. I looking forward to see more...

Pragmatic Systematic

11:30 Is it seriously better for performance? I'm of the mind that events are always slower than directly accessing the variables.

Sajjad Azarpour

dude you are back :) very good , your voice is older now :D
and finally you are using visual studio Tnx god :D
happy to see u again Jonathan,
Pls give us more fantastic tutorials

YumaApps Games

What's the point?

Gokay Akcay

Thanks dude! Every tutorial is explaining how can we write events instead of explaining why it is used but in this tutorial you explained both of them.


Can a delegate return a class?


Glad to have you back!!!


wow......you open my world up for new code logic. thank you!


Are delegates supposed to be used in complicated projects only ?

Marc-Étienne Ruffel

Seriously mate ! I just got an internship in a small studio and they asked me to learn about this because I didnt even know Delagate. Now in 19min53secs I've learned it , understand it and know how to use it.

Thanks !


Thank you!!!

Ted Thomas

Glad you're back :)

Siva Krishna Karri

yes...nice video...Can we hold a reference in update method..???

Zeurin Producciones

Another alternative 14:02 could be simply making static the event without the risk to access the player class from anywhere. GG WP

Nested Mango

Thanks for sharing . It will really help me a lot

Mamokoru Hollen

Thanks man You have amazing skills.


keep it up! you great man. dont stop this channel.

OXMOND Tutorials

Great stuff! Really cool tutorial! ??

Fuzzy D Pozzy

1:54 CallbackmyExGirlfriendSystem , so with that way you can call her anytime haha

Josiah Saunders

oh my goodness thank you. You explained this very clearly.


I was really looking forward to understanding delegates and events better, but your first method to change the color of the enemies was a lot less code then your second. So I don't see the point to using either D's or E's except when needing to know when a function has been called. Can you explain this for me? Thanks.


Where have you been i thought that you quit youtube which would suck because your videos really helped me with my programming



Aleksandar Stanisic


saad butt

Thanks. I' am struggling to understand this topic for a long time. I' have finally watch your video and it clears the purpose and concept of delegates. :D


LMAO, a Udemy course I'm subscribed to is going through delegates and events right now, they were confusing me quite a bit so I decided to look up more information, which brought me to this video. Half way through the video it was interupted by an ad, an ad that was for Udemy courses, and the ad was made by the very same instructors that I struggled to follow in the course in the first place.


Thanks so much!!!
I was just want to know this!

Ali İhsan Elmas

Great video! Clean explanation with a nice example!

zain ul abdeen

exactly what i was looking for the whole time and came up to the right dude . Awesome explanation keep up the good work

Jake Donaldson VR

Great tutorial, thanks!

Shane Stevens

Dude you are incredible

Patryk Szylin

Great series of Advanced stuff :) . Are you planning on uploading more videos anytime soon @Jonathan Weinberger ?

Gregory Fenn

Linq??? I want to learn about Linq :(


Thanks for very clear and detailed video

Face Swipe Gaming

Hi Does anyone know how to solve this problem in my event manager


THANK YOU!. Excellent tut. Subscribed. 8)

David Zobrist

The singleton on the player is not required. Actually you are not even using it.

If a member of a none static class is static you can access it throught the none static class type and have access to the member anyway.
Thats what you did:
Player.onEnemyHit += Damage; // accessing the none static type "Player" and calling the static event

if you would have used the singleton it would look like this:
Player._instance.onEnemyHit += Damage; // accesing the static instance of the class "Player" to gain access to the member
(which in your case was also static)

Anyways thanks very understandable tutorial.

mahmoud mostafa

Awesome, Waiting for the rest of the tutorial


Can we use Interface instead of this?


thanks,I finally understood delegate and event.

S. Simoes

Really well done. Thanks


16:50 Actually no but ok...


Very nice. Amazing!

Undercover Penguin

Omggg you are back :333 Miss your Amazing tutorials cc: I still yet to found better Teacher then you :3

Daniyal Azram

Why the hell would anyone dislike this video? maybe his ex:p

WILEz Giacio

Hi, I'm Italian and maybe I didn't understand the comments (in the speech).
It is not clear to me why to use the delegates when they can do without it. What changes? In what situation can it be useful?
Why not use the 11:20 minute code?
For performance?

Kryptoid Kryptonic

I watched this 6 months ago and it was awesome but I didnt completely understand. Used it a lil but than didnt need it for a long time. I came back to watch again today and omg it all makes so much more sense. Thanks!


You made this so easy thanks for lesson!


I get errors whenever I (or the scene manager) destroys objects that listen for events.


Can this be expanded so you click on something with your phone/tablet and your buddies get the same click registered on theirs?

simone zambonardi

I do not understand. Why use delegates and events to recall the function we need?


Common sense goes against the claim that it is more performant and efficient method.. But only legends know that common sense is not complete sense


Almost had it down until you threw the wrench in with the singleton


You're awesome! Your tutorials are what got me started. I really wish you were more active, as you're one of the best out there! Thank you so much for all the help you've given us.


This video is a godsend. I was trying to get events to work for hours before I watched this video. The problem was that I was using findobjectsoftype to put a reference in the subscriber script, but the publisher kept on thinking there was no subscribers. I changed it to static and calling it directly and everything worked. I'm guessing because of the slowness of findobjectsoftype it created a delay thus returning null subscribers in the publisher null check(it would work if I looped it in update). Anyway thanks heaps John!


there is that little lock button in the top right corner of inspector that helps so you can lock onto Gameobject with an array and then select mutliple things from hiearchy. : -)

Harry Sanders

Thanks for the entire series. Was some month away from Unity, these where the perfect starting point to refresh it and on top learn the next steps such as the use of events. This video helped me further and finally clearly understand its usage and use cases ! Thanks a lot!


good introduction. I am just in the process of designing my own callback system for my first game with the help of unityevent. Having the code more decoupled is almost always a good thing. However, while I jumped into the game programming I did not like it when I decoupled player movement and player animations. So I refactored this and made player movement and its animations more tightly coupled again, which led to fewer issues...

Should I keep animations and its corresponding moves more tightly coupled or is there a better approach to this?

Compose a Beat

That's great until you want to damage only one specific enemy but still have all the enemies listening.

Steve Anston

now I am more confused :)

good try though!


This video is seriously amazing

Alan Friedl

Wow, very clean, but i'm a bit confused becouse didn't know about singletons, i heard the therm before but neve dig into it, perhaps the times has come for that. Thanks for the advanced scripting series, it really help to dig dipper into coding in unity to produce good quality stuff.

Ayoze Fernández

Thanks for those great videos, I have a question:
testing it I saw I can store severals methods in a single Event and call all of them when I fire the event. How can I see how many methods are subscribed to my Event?

Giacomo Campa

I finally undestood how delegates and events work after having watched several videos. Thanks!

Christopher Koester

Thank you so much dude!!! I like the region concept too. That's nice as well.


Hmm... So is this similar to how event-driven programming works? I know that to add an event you have to use +=. Is a delegate what is used when you have an OnClick method or an OnFocus method in an application?

Siva Krishna Karri

yes...nice video...Can we hold a reference in update method..???


Just curious how this is more efficient? It seems like it is easier on the programmer, but we have a static event and in the background I'm sure it is doing a loop to call each Enemies Damage function. So I don't understand. how this is more efficient performance wise?

Either way, thanks for the tutorial. Delegates and events seem a lot simpler than I expected.

Heavy Coder

The best way to teach codding is through implementation with examples. and showing the Flow.
You are amazing at it. I am loving your tutorials about interfaces and delegates.


I started using delegates and events for UI and camera animations. I had no idea I was using the Observer pattern. Thanks!

mr. Gyarmati Vlogoldája

If I wanna make a Multiplayer game, use the singleton it's no way. Isn't it? So I mean I can use in single player mode only.


Thanks for the great tutorial! I am trying to do something like this, but i want the Player class to inherit from an abstract class or an interface so in the Enemy class i don't have to have a dependency on an implementation, but rather an abstraction. In other words, i want the Enemy class to follow the Dependency Inversion Principle. How can i modify your code to accomplish that?


I am begging you, do more of these

Mark Perry

I had an idea about delegates, now I have a much better idea and can utilise them efficiently. Ace video