private static void AddPieces() { AssetBundle assetBundle = AssetBundleHelper.GetFromResources("signed_chest"); lockers.Add(new BigWoodenLocker(assetBundle)); lockers.Add(new SignedLocker(assetBundle)); lockers.Add(new IronLocker(assetBundle)); lockers.Add(new HiddenStoneLocker(assetBundle)); assetBundle.Unload(false); }
private static void AddPieceFromPrefab() { AssetBundle assetBundle = AssetBundleHelper.GetFromResources("example_mod"); GameObject cubePrefab = assetBundle.LoadAsset <GameObject>("Assets/Prefab/Cube.prefab"); cubePrefab.FixReferences(); GameObject cloned = cubePrefab.InstantiateClone("SimpleCube"); GameObject hammerPrefab = Prefab.Cache.GetPrefab <GameObject>("_HammerPieceTable"); PieceTable hammerTable = hammerPrefab.GetComponent <PieceTable>(); hammerTable.m_pieces.Add(cloned.gameObject); assetBundle.Unload(false); }