Jump to content

IsValid and != null


Pudge

Recommended Posts

Hello! 

Please tell me the noob what is the difference between IsValid and != null. I've noticed that IsValid doesn't works correctly in some cases when I add check for objects/npcs/players, for example like this: var ganker = ObjectManager.GetObjectWoWPlayer().FirstOrDefault(g => g.IsAttackable && g.GetDistance < 150 && !g.IsDead);

Thanks in advance for answers!

Link to comment
Share on other sites

IsValid checks if it still exists in objectmanager. You never need it, unless you store a unit over a long period of time.
Because when you move 100 yards from the point of unit acquire, it might have disappeared from the objectmanager and not been updated either.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...