From 7e94a43dfba747fe3be633375186ae1f3c05048a Mon Sep 17 00:00:00 2001 From: Nathan Gill Date: Thu, 13 Aug 2020 03:35:28 -0400 Subject: [PATCH 1/2] Anvil Prefabs --- WurstMod/Any/AnvilPrefab.cs | 27 +++++++++++++++++++++++++++ WurstMod/WurstMod.csproj | 1 + 2 files changed, 28 insertions(+) create mode 100644 WurstMod/Any/AnvilPrefab.cs diff --git a/WurstMod/Any/AnvilPrefab.cs b/WurstMod/Any/AnvilPrefab.cs new file mode 100644 index 0000000..3ebd532 --- /dev/null +++ b/WurstMod/Any/AnvilPrefab.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +namespace WurstMod.Any +{ + public class AnvilPrefab : ComponentProxy + { + public string Guid; + public string Bundle; + public string AssetName; + + public override void InitializeComponent() + { + var asset = new Anvil.AssetID(); + asset.Guid = Guid; + asset.Bundle = Bundle; + asset.AssetName = AssetName; + Debug.Log("Asset bundle name: " + Bundle); + + var callback = AnvilManager.LoadAsync(asset); + callback.CompleteNow(); + + var prefab = Instantiate(callback.Result, transform.position, transform.rotation); + prefab.SetActive(true); + } + + } +} \ No newline at end of file diff --git a/WurstMod/WurstMod.csproj b/WurstMod/WurstMod.csproj index 575d690..3f79d51 100644 --- a/WurstMod/WurstMod.csproj +++ b/WurstMod/WurstMod.csproj @@ -69,6 +69,7 @@ + From cbf0927a1de813677a9d63024c9c5c39cabdcd8d Mon Sep 17 00:00:00 2001 From: Nathan Gill Date: Thu, 13 Aug 2020 03:45:29 -0400 Subject: [PATCH 2/2] Removed debug --- WurstMod/Any/AnvilPrefab.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/WurstMod/Any/AnvilPrefab.cs b/WurstMod/Any/AnvilPrefab.cs index 3ebd532..9895271 100644 --- a/WurstMod/Any/AnvilPrefab.cs +++ b/WurstMod/Any/AnvilPrefab.cs @@ -10,15 +10,8 @@ public class AnvilPrefab : ComponentProxy public override void InitializeComponent() { - var asset = new Anvil.AssetID(); - asset.Guid = Guid; - asset.Bundle = Bundle; - asset.AssetName = AssetName; - Debug.Log("Asset bundle name: " + Bundle); - - var callback = AnvilManager.LoadAsync(asset); + var callback = AnvilManager.LoadAsync(new Anvil.AssetID {Guid = Guid, Bundle = Bundle, AssetName = AssetName}); callback.CompleteNow(); - var prefab = Instantiate(callback.Result, transform.position, transform.rotation); prefab.SetActive(true); }