I write c++ singleton but not useful

AVRCharacter * AVRCharacter::GetInstance()
{
if (!instance)
{
instance = Cast(StaticClass()->GetDefaultObject());
}
return instance;
}
public:
static AVRCharacter* GetInstance();
private:
static AVRCharacter* instance;

it can compile,but when i call function by this singleton,ue_log is work,but actor location is not usefull,i doubt is not the singleton character in scene.
all at once,i use unity3d

private static singleton instance = null;
public static singleton Instance{get{return instance;}}
Awake()
{
if(instance == null)instance = this;
}
it works anytime

Singletones to Actors is completly not trivial feature in UE4 where used multiple windows and game mechanics.

Singletones is very dangerous and limited feature. If you running in editor with multiple windows, all this windows will be attemts to refer to one object, but this is different game instances, you will have many errors and implicitness!

oh,i got it,but how can i call function from other UClass such as A,i didnot want write UPROPERTY(EditAnywhere) for select the UClass A by hand,then use A‘s pointer,is there any way to call A’s function,in a word,i just want to use UClass A in other uclass

You can make static function, but these also are limited. You won’t be able to get actor’s location from there.

Whether you like it or not, this is how it works. You have object and you get data from that object. Thus you need to have reference to an object from which you want to get data from.