Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Integrate Unity with Dojo: A Quick Start Guide

This guide will walk you through the process of integrating Unity with Dojo using the Starknet Unity SDK.

Initial Setup

The repository already contains the dojo-starter as a submodule. Feel free to remove it if you prefer.

Prerequisites: First and foremost, ensure that Dojo is installed on your system. If it isn't, you can easily get it set up with:

curl -L https://install.dojoengine.org | bash

Followed by:

dojoup

For an in-depth setup guide, consult the Dojo book.

Launch the Example

Dojo Contract

After cloning the project, execute the following:

  1. init submodule
git submodule update --init --recursive
  1. Terminal 1 - Katana:
cd dojo-starter && katana --disable-fee
  1. Terminal 2 - Contracts:
cd dojo-starter && sozo build && sozo migrate

Unity

  1. Go to Unity Hub and add the unity folder as a project.
  2. In the Unity Editor, navigate to the Starknet SDK -> Setup to setup your game and do the following.
    • Select Dojo as your preferred game engine.
    • Enter http://localhost:5050 as the RPC Node.
    • Enter the World Address and System Address gotten from sozo migrate as the World Address and System Address respectively.
  3. Navigate to the Assets -> Scenes -> Game in the Project Hierarchy and open the Game scene.
  4. In the Game Hierarchy, select the PlayerCanvas -> Astronaut object. In the Inspector, you should see a Astronaut component. Fill in the Player Address field with the address of the player and Player key with the from Katana terminal.

Video Demo:

Video Demo

Making Requests to the Dojo Contract

The Astronaut.cs contains starter code for reading and writing to the Dojo contract. You can use this as a reference to make requests to the Dojo contract.

void Execute(string model, string[] args)

// Examples

// Spawning a new Player
string[] spwanArgs = new string[] { };
Execute("spawn", spwanArgs);

// Moving the Player to the left
string[] moveArgs = new string[] { "1" };
Execute("move", moveArgs);

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages