😎创建一个模组
Last updated
Last updated
// mod.json
{
"name": "模组名",
"author": "作者名",
"version": "版本号",
"description": "模组描述"
}// Main.cs
using UnityEngine;
using NeoModLoader.api;
using NeoModLoader.services;
namespace 命名空间名;
public class ModClass : IMod, MonoBehaviour
{
private ModDeclare _declare;
private GameObject _gameObject;
public ModDeclare GetDeclaration()
{
return _declare;
}
public GameObject GetGameObject()
{
return _gameObject;
}
public string GetUrl()
{
return "你模组的网站URL, 没有的话可以填仓库URL, 也可以填创意工坊物品页面, 也可以乱填";
}
public void OnLoad(ModDeclare pModDecl, GameObject pGameObject)
{
_declare = pModDecl;
_gameObject = pGameObject;
// 加载你的模组内容, 这个函数的调用甚至早于第一次Awake
// OnLoad -> Awake -> OnEnable -> Start -> Update
LogService.LogInfo($"[{pModDecl.Name}]: Hello World!");
}
}[NML]: [模组名]: Hello World!