Announcement

Collapse
No announcement yet.

UObject percists even after code is changed

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    UObject percists even after code is changed

    I have a class derived from UObject having a FTickableGameObject for custom ticks. And print out a a string debug message.

    I am only spawning 1 instance of the class in my game. But some times more than 1 instance of the object is present in the game. And when I change my debug printout message and hot reload, the old debug messages still persist.

    This gets solved when I restart the editor and I cannot intentionally recreate it.

    #2
    Originally posted by envenger View Post
    And when I change my debug printout message and hot reload, the old debug messages still persist.
    How do you change the message, in code? I can't say much without seeing the code, but it sounds like it could be related to the class default object.

    Comment


      #3
      If you only ever want one instance of that object in the game, my advice would be to make it a static, and make sure that the code fires an assert if you start spawning a second one. That way you'll also get a callstack and should be able to find out why it's happening. Something like:

      Code:
      UMyObject::SpawnStaticObject
      {
          if (MyStaticObject != nullptr)
          {
               ASSERT(TEXT("Trying to spawn new '' when one already exists!")
          }
      }

      Comment

      Working...
      X