Schedule Dedicated Servers Documentation
  • SDS Documentation
  • Schedule In Unity
    • Extracting the game to unity
    • Creating an assetbundle
  • Creating plugins
    • How to create a plugin
    • The ClientAPI (custom content)
  • Custom Assets
  • Plugin Events
  • Texture/Material Replacement
  • Chat Messages
  • Chat Commands
  • Console Commands
  • HAPI Methods
Powered by GitBook
On this page

Custom Assets

PreviousThe ClientAPI (custom content)NextPlugin Events

Last updated 1 month ago

This aims to show you how to spawn custom assets once you've followed Creating an assetbundle.

Once you got your .assets file, simply place it near your plugininfo.json file in your project as shown below. Then in your code in order to register it as a clientside bundle you simply have to use your plugin RegisterClientsideBundle(fileName) like shown below.

public void Start()
{
    string bundle = "circuit.assets";
    RegisterClientsideAssetBundle(bundle);
}

This will make players download your asset. Now let's make it spawn with ClientAPI.InstantiateClientObject

GameObject circuit = ClientAPI.InstantiateClientObject(bundle, "MarioCircuit", new Vector3(0, 3000, 0));

In the example above i'm spawning the GameObject named "MarioCircuit" at 3000units in the sky. You can spawn it at 0, 0, 0 so it'll be at the middle of the map in the ravin. In my example let's create a quick chat command so i can teleport to it.

[ChatCommand("circuit")]
public static void TPCommand(Player player)
{
    player.Teleport(circuit.transform.position + new Vector3(0, 1, 0));
    player.SendChatMessage("You have been teleported to the Mario Circuit!");
}

And just like that i can play mario kart in schedule I. Don't ask me why .

😂