Skip to content

Commit 64af11a

Browse files
authored
Documentation: Add guide on how to network sync objects (#34)
1 parent 438f029 commit 64af11a

24 files changed

Lines changed: 141 additions & 20 deletions

File tree

content/docs/world/meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"title": "World",
33
"icon": "Globe",
4-
"pages": ["index", "setup", "building", "testing"]
4+
"pages": ["index", "setup", "building", "testing", "props"]
55
}

content/docs/world/props.mdx

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
title: Props
3+
---
4+
5+
import { Callout } from 'fumadocs-ui/components/callout';
6+
7+
## What Are Props?
8+
9+
Props are interactive objects which can be loaded into a Basis scene and synchronised across a network.
10+
11+
## How to Create a Prop
12+
13+
- Select a game object and add a Basis Prop component to it.
14+
- Enter an Asset Bundle Name.
15+
- Optionally, add an Asset Bundle Description.
16+
- Press the 'Create Prop Bee File' button and wait for this process to complete.
17+
18+
![Inspector Window at Armature Gameobject](/img/props/1-.png)
19+
20+
- The results will be opened in a new window automatically as shown below.
21+
22+
![Inspector Window at Armature Gameobject](/img/props/3.png)
23+
24+
## How to Create a Network Synced Prop
25+
26+
Props can be network synced and generated at runtime. Below is example of how to load a network synced Pickup Interactable cube:
27+
28+
- Add a cube object in the scene hierarchy.
29+
30+
![Inspector Window at Cube](/img/props/2AA.png)
31+
32+
- Add a Basis Pickup Interactable component. This allows a local player to pick up and move the cube.
33+
34+
![Inspector Window at Basis Pickup Interactable component](/img/props/2B.png)
35+
36+
- Add a Basis Object Sync Networking component. This allows the cube to be synced for all players.
37+
38+
![Inspector Window at Basic Object Sync Networking component](/img/props/2C.png)
39+
40+
- Add a Basis Prop component, enter an Asset Bundle Name and press the 'Create Prop Bee File' button. The generated .bee files will be used by the Basis Runtime Loader to load the network synced cube into a scene.
41+
42+
![Inspector Window at Basic Object Sync Networking component](/img/props/2D.png)
43+
44+
### Spawning the Prop into a Scene Using the Runtime Loader
45+
46+
- Create an empty game object and give it a suitable name.
47+
48+
- Attach the Runtime Loader component to it.
49+
50+
- Enter your generated prop password and .bee url.
51+
52+
- Select Persistent to ensure synced changes persist for late-joining players.
53+
54+
![Inspector Window at Basic Object Sync Networking component](/img/props/3A.png)
55+
56+
- In the Unity Editor toolbar, select Basis and click on the Loadable Config Editor. This Basis config editor is used to genertate XML files which Basis can use to spawn props into a scene.
57+
58+
![Inspector Window at Basic Object Sync Networking component](/img/props/4B-.png)
59+
60+
- Enter 0 for the mode value. The 0 simply means that this is a loadable prop.
61+
62+
- Enter the same generated password and .bee url used previously.
63+
64+
- Select Persist to ensure synced changes persist for late-joining players.
65+
66+
- Click 'Save XML' and enter an appropriate file name to generate an XML file for the network synced pickup cube
67+
68+
![Inspector Window at Basic Object Sync Networking component](/img/props/4C.png)
69+
70+
- The generated XML will be located in: *Basis\Basis Server\BasisServerConsole\bin\Debug\net9.0\initialresources*
71+
72+
![Inspector Window at Basic Object Sync Networking component](/img/props/4D.png)
73+
74+
- Its output should look something like this:
75+
76+
![Inspector Window at Basic Object Sync Networking component](/img/props/4E.png)
77+
78+
### Checking the Server to Confirm the Prop Loads
79+
80+
- You can check if your prop is loaded correctly by the server. To do so, run the *BasisNetworkConsole.exe*, which is located at *Basis\Basis Server\BasisServerConsole\bin\Debug\net9.0*.
81+
82+
- *Note:*
83+
- You will need to register yourself as an admin for the prop to be able to load. You can do this by entering entering the command */admin add* did:key:\<YOUR-KEY\> or by editing *Basis\Basis Server\BasisServerConsole\bin\Debug\net9.0\config\admins.xml*.
84+
- You can find your key by opening up the Basis application and selecting your player's UUID in the Admin settings.
85+
86+
![Inspector Window at Basic Object Sync Networking component](/img/props/5A.png)
87+
88+
### Setting up the Basis Scene and Testing the Pickup Cube
89+
90+
- Before you can test out the network synced pickup cube, ensure that your scene has a Basis Scene component attached to an empty game object.
91+
92+
- Click 'Create Scene Bee File'.
93+
94+
- Open up the Load Config editor again.
95+
96+
- Enter your generated scene password and .bee url.
97+
98+
- Ensure Persistent is selected so that synced changes persist for late-joining players.
99+
100+
![Inspector Window at Basic Object Sync Networking component](/img/props/5B.png)
101+
102+
- Open up the 'Initialization' scene and press play. This initialises the created scene and network objects. The next time when you load the scene through the server while running the basis application, all players will be able to interact with the network synced cube.
103+
104+
![Inspector Window at Basic Object Sync Networking component](/img/props/5C.png)

package-lock.json

Lines changed: 28 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@
1515
"fumadocs-mdx": "13.0.8",
1616
"fumadocs-ui": "16.0.11",
1717
"lucide-react": "^0.552.0",
18-
"next": "16.0.1",
19-
"react": "^19.2.0",
20-
"react-dom": "^19.2.0"
18+
"next": "^16.0.1",
19+
"react": "^19.2.4",
20+
"react-dom": "^19.2.4"
2121
},
2222
"devDependencies": {
23+
"@eslint/eslintrc": "^3.3.1",
2324
"@tailwindcss/postcss": "^4.1.16",
2425
"@types/mdx": "^2.0.13",
2526
"@types/node": "^24.10.0",
2627
"@types/react": "^19.2.2",
2728
"@types/react-dom": "^19.2.2",
29+
"eslint": "^9.39.1",
30+
"eslint-config-next": "16.0.1",
2831
"postcss": "^8.5.6",
2932
"tailwindcss": "^4.1.16",
30-
"typescript": "^5.9.3",
31-
"eslint-config-next": "16.0.1",
32-
"eslint": "^9.39.1",
33-
"@eslint/eslintrc": "^3.3.1"
33+
"typescript": "^5.9.3"
3434
}
35-
}
35+
}

public/img/props/1-.png

14.9 KB
Loading

public/img/props/1.png

16.9 KB
Loading

public/img/props/2.png

12.5 KB
Loading

public/img/props/2A.png

25.1 KB
Loading

public/img/props/2AA.png

107 KB
Loading

public/img/props/2B.png

67.7 KB
Loading

0 commit comments

Comments
 (0)