Gorilla Time V2 is a focused BepInEx plugin with a deliberately small footprint. The source is organized into three namespaces that map directly to the three concerns of any BepInEx plugin: the entry point, the runtime logic, and the infrastructure. Understanding where each piece lives makes it straightforward to navigate the codebase and know exactly which file to touch for any given change.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ASTRA228b/Gorilla-Time-V2/llms.txt
Use this file to discover all available pages before exploring further.
Directory tree
File roles
Plugin.cs — BepInEx entry point
Plugin.cs is the file BepInEx discovers and loads. The plugin class extends BaseUnityPlugin and is decorated with the [BepInPlugin] attribute, which registers the plugin’s GUID, display name, and version with the BepInEx framework. Awake() runs first and creates the persistent Main MonoBehaviour GameObject; DontDestroyOnLoad keeps it alive across scene transitions. Start() runs immediately after and calls Pacther.Apply() to initialize HarmonyX patching.
Core/Main.cs — gameplay logic
Main.cs contains all runtime behavior. It is a MonoBehaviour attached to the persistent GameObject created in Plugin.cs. This file owns:
- Time control — a
TimeSettingsenum (Morning,TenAM,Day,Evning,Night) and aSystemSwitch()method called fromFixedUpdate()that maps each setting to aBetterDayNightManager.SetTimeOfDay()integer value. - Weather control —
StartRain()andStopRain()methods that iterate overBetterDayNightManager.instance.weatherCycleand set each slot toWeatherType1 (rain) or 0 (clear). - GUI rendering — an
OnGUI()method that draws a draggableGUILayout.Windowwith toggle buttons for each time setting and buttons for weather. Styles are lazy-initialized on the firstOnGUIcall viaINIT(). - Input handling —
Update()listens for theTkey viaUnity.InputSystemto toggle the GUI open or closed.
Safe/Constants.cs — plugin metadata
Constants.cs holds the three string constants that identify the plugin to BepInEx and HarmonyX. Centralizing them here means the GUID, display name, and version are never duplicated across files.
Safe/Patcher.cs — HarmonyX bootstrap
Patcher.cs exposes a single static Apply() method. It instantiates a Harmony object keyed to the plugin GUID and calls PatchAll(), which scans the assembly for any [HarmonyPatch]-annotated classes and applies them automatically. At present the plugin uses no manual patches, but this infrastructure is in place for future use.
Namespace structure
| Namespace | File(s) | Purpose |
|---|---|---|
Gorilla_Time.Plugin | Plugin.cs | BepInEx entry point and Unity lifecycle hooks |
Gorilla_Time.Core | Core/Main.cs | All gameplay logic — GUI, time, weather |
Gorilla_Time.Safe | Safe/Constants.cs, Safe/Patcher.cs | Shared metadata and HarmonyX bootstrap |
Plugin lifecycle
The sequence of execution from game launch to the running plugin:- BepInEx loads the plugin DLL from
BepInEx/plugins/MO/and discovers the[BepInPlugin]attribute onplugin. Awake()is called — a newGameObjectnamedGorilla.TimeV2is created, theMainMonoBehaviour component is attached, andDontDestroyOnLoadensures it persists across map changes.Start()is called —Pacther.Apply()creates aHarmonyinstance and runsPatchAll()to register any Harmony patches in the assembly.- Game loop begins — Unity calls
OnGUI()every frame for GUI rendering,Update()every frame for input polling, andFixedUpdate()on a fixed timestep to apply the selected time-of-day setting viaBetterDayNightManager.