Creating entity and camera component from other thread

Hi,

I have created a Gem integrating some grpc c++ server libraries describing some services.

I load a basic default level right from editor to have something to see.

map lobby

In one of my services, I am creating entities, this is occuring on a different thread than the main thread this way :

newEntity = aznew AZ::Entity(AZ::EntityId(entity_id(), name());

This seems to be working fine. The entity is initialised but not activated.

Then in another service I do :

EBUS_EVENT_RESULT(entity, AZ::ComponentApplicationBus, FindEntity, entityId);
entity->CreateComponent(CameraComponentTypeId);

The entity isn’t activated so adding the component works fine. The cameraComponent is created with default values.

I active the entity, seems ok.

Then in a third service, I call :

Camera::CameraRequestBus::Event(entityId, &Camera::CameraRequestBus::Events::MakeActiveView);

At this point, the screen turns completely black.

Could anyone point me what I am doing wrong please ? I guess first I’m not allowed to call the API from other threads the way I am doing ? Everything seems to work fine until I make the camera the active view thougth.
Is it because I missed something about the TickBus ?

I’m open to any advice :slight_smile:

Thanks

Yan

Hello!

Make sure your camera is not located in (0,0,0). The old CryEngine renderer disables rendering when camera is at the world’s origin.

thanks Cya.Sid

The camera was at (0,0,0) I’ve just moved it to (1,1,1) but no success, the screen stays black.

One thing I noticed is that in the debug information in the top right, CamPos stays at (0,5,34) the initial position in the loaded level.

Also, I cannot access the concole anymore after I change the camera from my service.