Skip to content

Digitalroot-Valheim/Digitalroot.CustomMonoBehaviours

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build NuGet Package Release Drafter

Digitalroot's Custom MonoBehaviours (CMB)

This repository is trying to answer the question. How do I get custom MonoBehaviours out of Unity and into Valheim?

License

💲 Closed-source license is available for commercial or personal use.

⚠️ WARNING ⚠️

  • Upload permission: You are not allowed to upload any files in this repository to other sites under any circumstances.
  • Asset use permission: You are not allowed to use any of the assets; Unity assets, image files, and icon file, in this repository under any circumstances.

Open Source License

  • Is your code private, closed-source, or proprietary?
  • Do you charge money to use your code?
  • Is your code not compatable with GNU Affero General Public License v3.0?

❗ If you answered YES to any of the above, you must acquire a Closed-source license. ❗

📃 If you answered NO to all the above questions. You may:

  • Direct your users to download the DLL from the GitHub Releases page.
  • Direct your users to download the DLL from the nexusmods.com page.

👨‍⚖️ Exemptions 👩‍⚖️

  • 1st Exemption: You may IL Weave the DLL into your own DLL, if, and only if, you meet the requirements for the Open Source License and you include, in your ReadMe file and Main page for downloading your code, one of the following statements in clear readable font at 12pt or higher. Take a look at ILMerge.Fody for your IL Weaving needs.

  • 2nd Exemption: You may include the DLL as part of a collection of DLLs aka Mod Packs, if, and only if, you meet the requirements for the Open Source License and you include, in your ReadMe file and Main page for downloading your collection, one of the following statements in clear readable font at 12pt or higher.

Statements

HTML

Uses <a href="https://tinyurl.com/drcmbs">Digitalroot's Custom MonoBehaviours</a> 

Markdown

Uses [Digitalroot's Custom MonoBehaviours](https://tinyurl.com/drcmbs)

Text

Uses Digitalroot's Custom MonoBehaviours - https://tinyurl.com/drcmbs

TL:DR Documentation

Tell the RepositoryLoader to load your DLL. I put this in Awake

RepositoryLoader.LoadAssembly("Digitalroot.CMB.Repository.dll");

Later when loading your asset, attach your CMB to the GameObject

Debug.Log("Loading Wizard");
var wizardAssetBundle = Jotunn.Utils.AssetUtils.LoadAssetBundleFromResources("wizard", Assembly.GetExecutingAssembly());
var wizard = wizardAssetBundle.LoadAsset<GameObject>("Wizard");
wizard.AddMonoBehaviour("CMB_SpinClockwise"); // Loaded from Digitalroot.CMB.Repository.dll
Jotunn.Managers.PrefabManager.Instance.AddPrefab(wizard);
wizardAssetBundle.Unload(false);

Full Example

Documentation

Check out the Wiki

Installation

There are a few choices for installation:

  1. Install the NuGet package via dotnet cli. dotnet add PROJECT package Digitalroot.CustomMonoBehaviours
  2. Install the NuGet package via Package Manager. PM> Install-Package Digitalroot.CustomMonoBehaviours
  3. For projects that support PackageReference, copy this XML node into the project file to reference the package.
    <PackageReference Include="Digitalroot.CustomMonoBehaviours" Version="1.0.*" />
  4. Download the NuGet Package from GitHub.
  5. Download the DLL from the GitHub Releases page.

Thanks to

OdinPlus