Skip to content

Commit c61f006

Browse files
Added "Connecting to Maincloud" section to part-4.md (#275)
* Update part-4.md added a proper main cloud section * Update part-4.md * Update docs/unity/part-4.md * Apply suggestions from code review --------- Co-authored-by: Tyler Cloutier <[email protected]>
1 parent 05a112c commit c61f006

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

docs/unity/part-4.md

+24
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,30 @@ We didn't even have to update the client, because our client's `OnDelete` callba
578578

579579
Notice that the food automatically respawns as you vaccuum them up. This is because our scheduled reducer is automatically replacing the food 2 times per second, to ensure that there is always 600 food on the map.
580580

581+
## Connecting to Maincloud
582+
- Publish to Maincloud `spacetime publish -s maincloud <your module name> --delete-data`
583+
- `<your module name>` This name should be unique and cannot contain any special characters other than internal hyphens (`-`).
584+
- Update the URL in the Unity project to: `https://maincloud.spacetimedb.com`
585+
- Update the module name in the Unity project to `<your module name>`.
586+
- Clear the PlayerPrefs in Start() within `GameManager.cs`
587+
- Your `GameManager.cs` should look something like this:
588+
```csharp
589+
const string SERVER_URL = "https://maincloud.spacetimedb.com";
590+
const string MODULE_NAME = "<your module name>";
591+
592+
...
593+
594+
private void Start()
595+
{
596+
// Clear cached connection data to ensure proper connection
597+
PlayerPrefs.DeleteAll();
598+
599+
// Continue with initialization
600+
}
601+
```
602+
603+
To delete your Maincloud module, you can run: `spacetime delete -s maincloud <your module name>`
604+
581605
# Conclusion
582606

583607
:::server-rust

0 commit comments

Comments
 (0)