Select a character to interact with and add them to the scene.
In this tutorial, we will select a character and use the "Spawn Asset" resource to add them to our scene.
In this sandbox environment, you have two characters to choose from:
We will be dynamically adding one of these characters to the scene.
Step 1: Create a New Script
- Create a new script called "Spawn Character":
- Open the "Spawn Character" script.
Step 2: Rename the First Frame and Add a Positional Anchor
- With the "Spawn Character" script open, re-name the first frame "Position":
- Open the catalogs by clicking on the folder icon on the far right:
- Find the catalog called "Character Positions".
- Drag "Character at Office Door" to your frame:
Step 3: Spawn Character
- With the Spawn Character script open, create a new main frame.
- Re-name it "Spawn Character":
- Go to the Resources tab.
- Find "Spawn Asset".
- Drag and drop "Spawn Asset" in your frame.
- Click the "+" beside the "Asset Instance".
- Click the "+" beside "Asset". The catalog will open.
- Choose "Character Assets".
- Choose either Female_Character_Stacey or Male_Character_Ted. In this tutorial, we've chosen Stacey.
Finally, you need to set the position of the character. We have created predetermined positional anchors and have added one to this script.
- Find "Relative Position" in the Position dropdown.
You will see space to enter coordinates of a relative position, but there is also a field for "Anchor Object".
- Under Anchor Object dropdown, choose "Character at office door".
- Save the script.
As you've learned, we must add this Spawn Character script to the Director Script in order for it to run.
- Open the Director Script.
- Add a new top-level frame.
- Re-name the frame "Spawn Character".
- Drag the Spawn Character script into the frame.
- STOP: Save and test. You will now see the character standing at the door.
In the Headset
This is what your scenario will look like so far:
Key Takeaways from Tutorial 4
- When spawning an asset, you need to set the position of the character. This can be done via a positional anchor that you've added to your catalog or you will see space to enter coordinates of a relative position.