I followed this tutorial for getting my character to work in MR Bring AI Characters to Your Mixed Reality Projects in Meta Quest | Convai Unity 6 XR Tutorial
The instruction was that the character prefab should be added to the object prefab under Object Spawner. I did this and only the dialogue box is spawned on runtime, no character is visible or is identified in the box. The SDK can’t seem to identify the character when it’s only in the scene as an object to spawn.
What did you expect?
I expected the character to spawn on runtime.
Steps to reproduce
Add a character to an MR template scene as an object to be spawned
Go into play mode
Test if the character is visible and is identified at run time
Unity Console errors or build logs
NullReferenceException: Object reference not set to an instance of an object
UnityEngine.XR.Templates.MR.SpawnedObjectsManager.Start () (at Assets/MRTemplateAssets/Scripts/SpawnedObjectsManager.cs:79)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__7_0 (System.Object state) (at <1eb9db207454431c84a47bcd81e79c37>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <31f3cd5c2a074982a9d5664e7709cac1>:0)
UnityEngine.UnitySynchronizationContext.Exec () (at <31f3cd5c2a074982a9d5664e7709cac1>:0)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at <31f3cd5c2a074982a9d5664e7709cac1>:0)
I tried touching the ground with all the different controller buttons in MR but no character object spawned. I can interact with the character by voice it’s just the character as an object not showing.
Yes it works with the MR template scene to spawn their triangle demo object.
The main issue I’m facing is that when following this workflow, ConvAI does not recognise the character unless it is already in the scene as a GameObject (not just a component of the object to be spawned). I have tried separating the character game object from the actual avatar model to be spawned using an empty game object with character and audio output components. The result is that the model appears but is not animated, just in T pose, but is able to have audio dialogue. What do you advise?
Could you please clarify exactly what you are trying to achieve with this setup?
If the Convai character is not present in the scene, it will not connect to the room and initialize as expected.
If you can share a bit more detail about your intended spawning workflow, what is being spawned at runtime, and how you expect the Convai character and avatar to be linked, we can provide more accurate guidance.
I’m just trying to achieve the same thing as the tutorial, to spawn a character that is able to be interacted with in MR.
I had followed the previous tutorial (linked in that one’s comments). But then to make it spawn in MR instead of being already present in the scene, I removed this game object and added it instead as a prefab to spawn as it is in this tutorial. This is what has caused this disconnection issue between character and avatar. What I expected is that the spawn function would produce the avatar prefab with working connections to its animations and character component.
I think to solve this I need to find out exactly how the character component/avatar prefab hierarchy should be to achieve a successful spawn, because using the avatar prefab with character and audio components created in the first setup tutorial didn’t work for me.
If you are using the latest Convai Unity SDK, you should not need any special setup for this.
In the Object Spawner, assign the character prefab from the Convai sample scene to the prefab field. Then enter Play Mode. On your XR device, the environment should be scanned first. Once a suitable surface is detected, tap the location where you want the character to appear, and the character should spawn there with its Convai setup intact.
Please keep in mind that this is only a sample implementation. For a production project, it would be better to create your own object spawning workflow based on your MR interaction requirements, rather than depending directly on the sample spawner.