Mega UI
Project setup
The whole csproj, and the four things in it that are easy to get wrong.
The whole file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>MyMod</AssemblyName>
<RootNamespace>MyMod</RootNamespace>
<LangVersion>latest</LangVersion>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
<Version>1.0.0</Version>
<GameDir>C:\Program Files (x86)\Steam\steamapps\common\Megastore Simulator</GameDir>
<Managed>$(GameDir)\Megastore Simulator_Data\Managed</Managed>
</PropertyGroup>
<ItemGroup>
<Reference Include="MegaUI">
<HintPath>$(GameDir)\BepInEx\plugins\rodopoulos\MegaUI.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="BepInEx">
<HintPath>$(GameDir)\BepInEx\core\BepInEx.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>
</Project>netstandard2.1, not net6.0 and not net35
The game runs on Mono, so a net6.0 assembly will not load. net35 is the
classic target for Mono mods and it fails a modern SDK with MSB3644 — the
.NET Framework 3.5 reference assemblies do not ship any more. netstandard2.1 avoids
both: NuGet supplies the reference assemblies and Unity's Mono supports the profile natively.
Private=false on every reference
Without it MSBuild copies the referenced dll into your output. Ship that folder and the player ends up with two copies of Mega UI — or half the game's assemblies — in their plugins directory.
No UI assemblies
You do not reference UnityEngine.UI, UnityEngine.UIModule or
Unity.TextMeshPro.
If you find yourself adding a UI assembly to draw part of your screen, something is missing from the API. Say so rather than working around it — that is how the next widget gets picked.
The game folder
The paths above assume a default Steam install. On a non-Steam or moved install, point
GameDir at wherever Megastore Simulator.exe lives — everything else
is derived from it.
Getting IntelliSense
MegaUI.xml ships next to the dll in the release zip. Keep the two side by side and
your editor explains every method and field while you type. If your autocomplete is bare, that file
is missing from the folder HintPath points at.
Build and install
dotnet build MyMod.csproj -c ReleaseCopy bin/Release/netstandard2.1/MyMod.dll into BepInEx/plugins/.
The game holds plugin dlls open while it runs, so copying over one fails with a lock error that reads like a permissions problem. Close the game first.