Example #1
0
    //The start function; we should handle loading all files in here
    //Not in the constructor
    private void Start()
    {
        //Load the asset bundle
        AssetBundle assetBundle = AssetBundle.LoadFromFile("Assets/AssetBundles/raftmod_items");

        if (assetBundle == null)
        {
            RConsole.Log("Couldn't find the asset bundle");
            return;
        }

        //Load the sprite
        Sprite icon = assetBundle.LoadAsset <Sprite>("garbage");

        //Add a new item to the game
        this.garbage = new ModItem(ItemType.Inventory, "Garbage", "It's just garbage");
        this.garbage.SetIcon(icon);
        ModHelper.AddItem(this, this.garbage);
    }