Skip to content

Commit

Permalink
Put verta file in plugin folder
Browse files Browse the repository at this point in the history
  • Loading branch information
limoka committed Feb 9, 2021
1 parent 560965d commit 2ca14fc
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion DSP_CustomBuildings/DSPCustomBuildings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ public class DSPCustomBuildings : BaseUnityPlugin

public static AssetBundle bundle;

public static string pluginfolder;


void Awake()
{
logger = Logger;

//get location of the plugin
string pluginfolder = System.IO.Path.GetDirectoryName(GetType().Assembly.Location);
pluginfolder = System.IO.Path.GetDirectoryName(GetType().Assembly.Location);

//asset bundle to load
string assetBundle = "custombundle";
Expand Down Expand Up @@ -312,4 +314,20 @@ public static bool LoadHook(ref string path, ref UnityEngine.Object __result) {
return true;
}
}

[HarmonyPatch(typeof(VertaBuffer), "LoadFromFile")]
static class VertaBufferPatch
{
[HarmonyPrefix]
public static bool LoadHook(ref string filename) {

if (filename.Contains("custommachines"))
{
filename = $"{DSPCustomBuildings.pluginfolder}/{filename}";

DSPCustomBuildings.logger.LogInfo("Loading my verta file " + filename);
}
return true;
}
}
}

0 comments on commit 2ca14fc

Please sign in to comment.