Can't spawn actor from QR Code location [4-27]

I am trying to spawn an actor in the room based on the location of a tracked QR code. First i am tracking the QR code similar to this introduction: QR codes in Unreal - Mixed Reality | Microsoft Learn

With the specific location i am using the “Spawn actor from class” component to get the spawn the cube which is defined in another blueprint. I think it should work like this, but when i try at the HoloLens2 there are no spawned objects in the room.
I checked the output of the return value in the end. I get the array length, which is always 1, the location, which is the same like the QR code, and the Display Name of the object, which is BP_Cube01.
Maybe it could be an issue with the blueprint communication? Any ideas?
Thanks

Why have the GetActorOfClass? Have you tried putting a print string after the spawn, is it called?

The GetActorOfClass is not neccessary. You can ignore that :slight_smile: I checked the output of the SpawnActor by several PrintStrings and yes it is called. The output contains one object with the name BP_Cube01 at the location of the QR Code.

Ok. After spawning, press F8 ( it lets you escape the game while it’s running ), and take a look at the world outliner. Can you see your cube? Click on it and take a look at the coordinates. Is it where it should be?

Thanks for the hint and well, i found out some interesting things. The cube doesn’t spawn in my level ( it is not at the world outliner) BUT it spawns in the viewport of my QRCodeTracking Blueprint (which should be empty). I am a beginner in unreal engine, but i guess the cube shouldn’t spawn there… Any idea what is wrong?

I don’t know what your setup is there really. But that QR event must be spawning the cube into the wrong level. I don’t understand how you have more than one level open unless you’re using streaming, but…

If you want the spawn to happen in the correct level, you’ll need to pass and even to there to make it happen in that area.

Any easy way is to make a cube spawner BP that only spawns when you call a custom event ( in it ). Just make sure you have one in the level and call that from your QR event instead of spawning directly.

Like I say, don’t really understand your setup, so I’m kinda working in the dark here…

I tried different things. I have just one level with one level blueprints and different other blueprints for my actors, widgets and so on. I tried to call the spawn from a custom event of another blueprint (like you suggested), but the problem is the same. The Cube spawns in the viewport window but not in the level. I can’t even select or delete it. Finally i have chosen a completely different way to reach my goals. However it would be interessting to understand the issue, so if someone has further ideas, it would try them.

My main problem is I don’t understand your distinction between viewport and level.

This viewport is always showing the current level, no?

Hi @anonymous_user_3d03c3661 I’m trying to load a simple cube on a QR code. I’ve been through the Unreal Mixed Reality docs in MS docs several times without much luck. Are you able to point me to any other resources? It would be greatly appreciate

Hi Mrbeaufridges, i used the MS docs, too. But until now i wasn’t able to fix my problem. So, i was able to get the position of the qr code, but i can’t spawn the cube at this location. I am really sorry, that I can’t help you at the moment.

No worries. Thanks Kashima