TWeakObjectPtr is "STALE" when assigned valid Actor

undercover
Fri, 30 Nov 2018 15:23:50 +0000
Platform & Builds

Hi!

After upgrading to 4.21 from 4.19 I have a problem with TWeakObjectPtr being stale directly after assigned a valid actor?

bool bIsValidLowLevel = actor_placed_in_editor->IsValidLowLevel();

	TWeakObjectPtr<AActor> test_pointer;
	test_pointer = actor_placed_in_editor;

	bool bIsState = test_pointer.IsStale();
	bool bIsValid = test_pointer.IsValid();

After the above code is run, the status is

bIsValidLowLevel = true

bIsState = false

bIsValid = true

However, if I hover over test_pointer it says “STALE”. If the pointer is used, e.g. Cast<ISomeInterface>(test_pointer.Get()), the game crashes.

Any help would be appreciated!

7 posts - 7 participants