Jump to content

IsValid and != null


Pudge
 Share

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...