Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions Distance.CustomCar/Assets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@ private object Load()
{
try
{
var assetBundle = AssetBundleBridge.LoadFrom(FilePath);
Mod.Log.LogInfo($"Loaded asset bundle {FilePath}");

return assetBundle;
return AssetBundleBridge.LoadFrom(FilePath);
}
catch (Exception ex)
{
Expand All @@ -81,15 +78,18 @@ private object Load()

internal static class AssetBundleBridge
{
public static Type AssetBundleType => Kernel.FindTypeByFullName(
"UnityEngine.AssetBundle",
"UnityEngine"
);

private static MethodInfo LoadFromFile => AssetBundleType.GetMethod(
"LoadFromFile",
new[] { typeof(string) }
);
private static Type _assetBundleType;
private static MethodInfo _loadFromFile;

static AssetBundleBridge()
{
_assetBundleType = Kernel.FindTypeByFullName("UnityEngine.AssetBundle", "UnityEngine");
_loadFromFile = _assetBundleType.GetMethod("LoadFromFile", new[] { typeof(string) });
}

public static Type AssetBundleType => _assetBundleType;

private static MethodInfo LoadFromFile => _loadFromFile;

public static object LoadFrom(string path)
{
Expand Down
Loading
Loading