SHA256
Document Render Core And API
This commit is contained in:
22 files changed
+1241
-27
No files matched your search
@@ -6,9 +6,16 @@ using UnityEngine;
|
||||
|
||||
namespace ADOFAIRenderer.Util;
|
||||
|
||||
/// <summary>
|
||||
/// Loads the Unity asset bundles (fonts, shaders) embedded in the mod DLL as manifest resources. One bundle set is
|
||||
/// embedded per platform (Bundle/Win64, Bundle/OSX, Bundle/Linux).
|
||||
/// Main thread (AssetBundle loading).
|
||||
/// </summary>
|
||||
internal static class BundleLoader
|
||||
{
|
||||
/// <summary>Resource folder of the running platform: "Win64" on Windows, "OSX" on macOS, "Linux" otherwise.</summary>
|
||||
private static readonly string BundlePlatform;
|
||||
/// <summary>The mod assembly that contains the bundle resources.</summary>
|
||||
private static readonly Assembly? ExecutingAssembly;
|
||||
|
||||
static BundleLoader()
|
||||
@@ -22,6 +29,16 @@ internal static class BundleLoader
|
||||
ExecutingAssembly = Assembly.GetExecutingAssembly();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads the bundle stored as manifest resource "ADOFAIRenderer.Bundle.<platform>.<resourcePath>" with
|
||||
/// AssetBundle.LoadFromStream. The resource stream is disposed when this method returns. The caller owns the returned
|
||||
/// bundle.
|
||||
/// Reference: https://docs.unity3d.com/ScriptReference/AssetBundle.LoadFromStream.html
|
||||
/// </summary>
|
||||
/// <param name="resourcePath">Bundle name inside the platform folder, for example "fonts" or "shaders".</param>
|
||||
/// <returns>The loaded bundle, or null when Unity fails to load it.</returns>
|
||||
/// <exception cref="MissingManifestResourceException">The resource is not embedded in the DLL.</exception>
|
||||
/// <exception cref="InvalidOperationException">The executing assembly is not available.</exception>
|
||||
public static AssetBundle GetBundle(string resourcePath)
|
||||
{
|
||||
if (ExecutingAssembly != null)
|
||||
|
||||
Reference in new issue
Block a user