# What's the difference between using TWeakObjectPtr or using UObject\*

**URL:** <https://forums.unrealengine.com/t/whats-the-difference-between-using-tweakobjectptr-or-using-uobject/284354>\
**Category:** Community & Industry Discussion\
**Tags:** garbage-collector, uobject, unreal-engine, question\
**Created:** [May 27, 2014, 2:35pm UTC](https://forums.unrealengine.com/t/whats-the-difference-between-using-tweakobjectptr-or-using-uobject/284354 "2014-05-27T14:35:50Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [May 28, 2014, 4:49am UTC](https://forums.unrealengine.com/t/whats-the-difference-between-using-tweakobjectptr-or-using-uobject/284354/3 "2014-05-28T04:49:58Z")

</div>

Dear ,

#There’s a Huge Difference, One Will Always Crash

There’s a huge **game-breaking difference** between your two examples!

* * *

This will never crash

```
    TWeakObjectPtr<UObject> WeakPointer;
   if( WeakPointer.IsValid()) {}

```

The below code is **guaranteed to crash every single time** based on how you’ve written in it

```
UObject *Obj;
if(Obj->IsValidLowLevel()){}

```

reason = you are de-referencing a pointer that is pointing to nothing (dereference is the **→** operator)

#IsValidLowLevel()

IsValidLowLevel is not meant to be used for verifying the pointer, it is for verifying the integrity of the UObject after it is already known to exist, but might have been deleted recently. See below for how you can verify the pointer itself.

#Solution  
If using raw c++ pointers, you can just do this

```
UObject* Obj;
if(Obj != nullptr)
{
  //Safe!
  Obj->GetName();
}

```

The above using raw C++ pointers, and the example using .IsValid() are the two cases that are equivalent, and both are safe.

#Why is this such a big deal?

Whether you understand this difference properly is what makes your game crash to desktop constantly, or run stable all the time (minus any infinite while loops hee hee) 🙂

---

_[View the full topic](https://forums.unrealengine.com/t/whats-the-difference-between-using-tweakobjectptr-or-using-uobject/284354)._
