Finalize Mod #8

Merged
david merged 17 commits from dev into main 2026-08-24 17:20:17 +02:00
2 changed files with 66 additions and 1 deletions
Showing only changes of commit 8398bf5f12 - Show all commits
+57
View File
@@ -1,4 +1,5 @@
using System.IO; using System.IO;
using System.Linq;
using UnityEngine; using UnityEngine;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
@@ -11,6 +12,9 @@ namespace IngameReveries
{ {
private GameObject _ingameReveriesUI; private GameObject _ingameReveriesUI;
private AssetBundle _reveriesBundle;
private GameObject _reveriesPrefab;
private void Awake() private void Awake()
{ {
// Metadata of your mod is stored in this.about // Metadata of your mod is stored in this.about
@@ -23,6 +27,8 @@ namespace IngameReveries
private void Start() private void Start()
{ {
InitializeAssets();
SceneManager.sceneLoaded += (scene, mode) => SceneManager.sceneLoaded += (scene, mode) =>
{ {
// Check if UI already instantiated // Check if UI already instantiated
@@ -58,5 +64,56 @@ namespace IngameReveries
Debug.Log("Good bye! " + mod.metadata.id); Debug.Log("Good bye! " + mod.metadata.id);
harmony.UnpatchAll(); harmony.UnpatchAll();
} }
private void InitializeAssets()
{
string bundlePath = Path.Combine(mod.path, "assets", "bundle");
if (!File.Exists(bundlePath))
{
Debug.LogError($"[IngameReveries] Bundle not found at: {bundlePath}");
return;
}
_reveriesBundle = AssetBundle.GetAllLoadedAssetBundles()
.FirstOrDefault(b => b.name == "logosteal" || b.mainAsset != null);
if (_reveriesBundle == null)
{
// If it isn't loaded yet, load it from disk
Debug.Log("[IngameReveries] Loading Bundle");
_reveriesBundle = AssetBundle.LoadFromFile(bundlePath);
}
else
{
Debug.Log("[IngameReveries] Bundle already loaded");
}
if (_reveriesBundle == null)
{
Debug.LogError("[IngameReveries] Failed to load AssetBundle!");
return;
}
// Load the prefab from the bundle
string assetName = _reveriesBundle.GetAllAssetNames().First();
_reveriesPrefab = _reveriesBundle.LoadAsset<GameObject>(assetName);
if (_reveriesPrefab == null)
{
Debug.LogError("[IngameReveries] Failed to load prefab!");
// List what's in the bundle for debugging
string[] assetNames = _reveriesBundle.GetAllAssetNames();
Debug.Log("[IngameReveries] Assets in bundle:");
foreach (string name in assetNames)
{
Debug.Log($" - {name}");
}
return;
}
Debug.Log("[IngameReveries] Successfully loaded prefab!");
}
} }
} }
+9 -1
View File
@@ -219,6 +219,10 @@
<HintPath>$(GameManagedDir)\Unity.VisualEffectGraph.Runtime.dll</HintPath> <HintPath>$(GameManagedDir)\Unity.VisualEffectGraph.Runtime.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="UnityEngine.AssetBundleModule">
<HintPath>$(GameManagedDir)\UnityEngine.AssetBundleModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule"> <Reference Include="UnityEngine.CoreModule">
<HintPath>$(GameManagedDir)\UnityEngine.CoreModule.dll</HintPath> <HintPath>$(GameManagedDir)\UnityEngine.CoreModule.dll</HintPath>
<Private>False</Private> <Private>False</Private>
@@ -277,7 +281,11 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="src\" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="echo &quot;Copy build to game folder&quot;&#xA;mkdir -p &quot;$(GameModsDir)&quot;&#xA;cp -r &quot;$(ProjectDir)about&quot; &quot;$(GameModsDir)&quot;&#xA;cp -r &quot;$(ProjectDir)bin&quot; &quot;$(GameModsDir)&quot;" /> <Exec Command="echo &quot;Copy build to game folder&quot;&#xA;mkdir -p &quot;$(GameModsDir)&quot;&#xA;cp -r &quot;$(ProjectDir)about&quot; &quot;$(GameModsDir)&quot;&#xA;cp -r &quot;$(ProjectDir)bin&quot; &quot;$(GameModsDir)&quot;&#xA;cp -r &quot;$(ProjectDir)assets&quot; &quot;$(GameModsDir)&quot;" />
</Target> </Target>
</Project> </Project>