SpawnActor not visible on camera/game simulation

So the issue i’m having is that, either spawning an actor through blueprint or c++, is not appearing visible through the players camera nor if i play as standalone game. However it appears in editor viewport.

As i thought it might have to do with my project and a deeper problem that i was not able to see, i tried to replicate the problem yet again on a clean project, and the problem persists.

Here is how i replicate it for c++:

MyActor.h

#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "MyActor.generated.h"

UCLASS()
class CPPTESTING_API AMyActor : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	AMyActor();

	UFUNCTION(BlueprintCallable, Category = "Something")
		bool TestingSpawn();

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Something")
		AActor * TestActor;
};

MyActor.cpp

#include "MyActor.h"
#include "Engine/World.h"

// Sets default values
AMyActor::AMyActor()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

}

bool AMyActor::TestingSpawn()
{
	UWorld * World = GetWorld();

	if (!World) return false;

	FActorSpawnParameters SpawnParams;
	SpawnParams.Owner = this;
	SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;

	AActor * SpawnedObj = World->SpawnActor<AActor>(TestActor->GetClass(), FVector(0, 0, 0), FRotator(0, 0, 0), SpawnParams);

	return true;
}

Then I need to set an actor to my TestActor. I decided to set it through the editor like so:

1)Place a BP version of MyActor on level

2)Create a BP of an actor with a static mesh component (can be anything, i chose the default engine Cube) and make sure it’s movable. Let’s call this SomethingActor.

  1. Place SomethingActor in the same level as MyActorBP.

  2. Now you can add SomethingActor to the TestActor in MyActorBP.

For the blueprint case, just create two actors, one being the one that spawns and the one that is the class you want to spawn.
Happens the same.

You might notice that i also have a custom GameModeBase and a Pawn, that was to make it easier to check the camera freely through my pawn.

I have been trying to solve this all day and i just don’t know if it’s me that i’m missing a step somewhere or is it rly a rendering bug.

Thank you for your time,

KittyT

I apologize, i forgot to post what i was visualizing

On this image below, the contour in red means the spawned object, and where it should be on the camera of my pawn, which the camera is the one contoured in yellow

Adding a screenshot of when i spawn the objects, be it blueprint or c++, i call it at begin play. The one i have active atm is the blueprint call with the spawnactor node found in blueprints

Just tested this on 4.21, have the same issue… I am just now trying to spawn something from the content with spawnactor, all in blueprints, and i get the same issue. Am I missing something? ;-; It’s not the first time i spawned something this way, it is the first time it is not spawning in camera but spawning in the editor viewport though. ;-;

Okay, so i decided to also try with later versions, and on 4.19 has no issue. Works just fine. So i tried to see what might be wrong… I noticed that the pawn i am creating i did not do for the 4.19 test. So my issue is with the pawn itself. I shall try to see why with a default pawn works, but the one i had did not, If anyone has a suggestion is more than welcome ;-;