Skip to content

Commit 4f54b9c

Browse files
committed
Merge branch 'beta'
2 parents e31a029 + 98ae3dc commit 4f54b9c

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

Assets/MapEditor/Editor/Managers/SceneViewManager.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,13 @@ public static bool GetMouseScenePos(out RaycastHit hit)
3333
private static void SpawnPrefab()
3434
{
3535
if (GetMouseScenePos(out RaycastHit hit))
36-
{
3736
PrefabManager.Spawn(hit.point);
38-
}
3937
}
4038

4139
private static void OnMouseDown()
4240
{
4341
if (Event.current.button == 0)
44-
{
4542
SpawnPrefab();
46-
}
4743
}
4844

4945
private static void OnDragExited()

Assets/MapEditor/Editor/TreeView/PrefabsList/PrefabsListTreeView.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,12 @@ void SetItemSelected(int id)
232232
var itemClicked = treeModel.Find(id);
233233
if (itemClicked.rustID == 0)
234234
return;
235+
236+
PrefabManager.Load(itemClicked.rustID).SetActive(true);
235237
previewImage = AssetPreview.GetAssetPreview(PrefabManager.Load(itemClicked.rustID));
236238
if (previewImage == null)
237239
previewImage = new Texture2D(60, 60);
240+
238241
prefabData = PrefabManager.Load(itemClicked.rustID).GetComponent<PrefabDataHolder>().prefabData;
239242
prefabName = itemClicked.prefabName;
240243
}

Assets/MapEditor/Managers/AssetManager.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ public static class AssetManager
1111

1212
public static AssetBundleManifest AssetManifest { get; private set; }
1313

14-
private static Dictionary<uint, string> IDLookup = new Dictionary<uint, string>();
15-
private static Dictionary<string, uint> PathLookup = new Dictionary<string, uint>();
14+
public static Dictionary<uint, string> IDLookup { get; private set; } = new Dictionary<uint, string>();
15+
public static Dictionary<string, uint> PathLookup { get; private set; } = new Dictionary<string, uint>();
1616

17-
public static Dictionary<string, AssetBundle> Bundles = new Dictionary<string, AssetBundle>(System.StringComparer.OrdinalIgnoreCase);
18-
public static Dictionary<string, AssetBundle> AssetPaths = new Dictionary<string, AssetBundle>(System.StringComparer.OrdinalIgnoreCase);
19-
public static Dictionary<string, Object> Cache = new Dictionary<string, Object>();
17+
public static Dictionary<string, AssetBundle> Bundles { get; private set; } = new Dictionary<string, AssetBundle>(System.StringComparer.OrdinalIgnoreCase);
18+
public static Dictionary<string, AssetBundle> AssetPaths { get; private set; } = new Dictionary<string, AssetBundle>(System.StringComparer.OrdinalIgnoreCase);
19+
public static Dictionary<string, Object> Cache { get; private set; } = new Dictionary<string, Object>();
2020

2121
public static bool IsInitialised { get; private set; }
2222

@@ -69,7 +69,7 @@ public static void Initialise(string bundlesRoot)
6969
return;
7070
}
7171

72-
for (uint index = 0; (long)index < (long)Manifest.pooledStrings.Length; ++index)
72+
for (uint index = 0; index < Manifest.pooledStrings.Length; ++index)
7373
{
7474
IDLookup.Add(Manifest.pooledStrings[index].hash, Manifest.pooledStrings[index].str);
7575
PathLookup.Add(Manifest.pooledStrings[index].str, Manifest.pooledStrings[index].hash);
@@ -86,7 +86,7 @@ public static void Initialise(string bundlesRoot)
8686
Debug.Log("Bundle already loaded.");
8787
}
8888

89-
public static T GetAsset<T>(string filePath) where T : Object
89+
private static T GetAsset<T>(string filePath) where T : Object
9090
{
9191
AssetBundle bundle = null;
9292

Assets/MapEditor/Managers/PrefabManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public static GameObject Process(GameObject go, string filePath)
5555
}
5656
PrefabDataHolder prefabDataHolder = go.AddComponent<PrefabDataHolder>();
5757
prefabDataHolder.prefabData = new PrefabData() { id = AssetManager.ToID(filePath) };
58-
go.SetActive(true);
5958
return go;
6059
}
6160

@@ -67,14 +66,15 @@ public static void Spawn(GameObject go, PrefabData prefabData, Transform parent)
6766
newObj.transform.localScale = new Vector3(prefabData.scale.x, prefabData.scale.y, prefabData.scale.z);
6867
newObj.name = go.name;
6968
newObj.GetComponent<PrefabDataHolder>().prefabData = prefabData;
69+
newObj.SetActive(true);
7070
}
7171

7272
/// <summary>Spawns the prefab set in PrefabToSpawn at the spawnPos</summary>
7373
public static void Spawn(Vector3 spawnPos)
7474
{
7575
if (PrefabToSpawn != null)
7676
{
77-
GameObject.Instantiate(PrefabToSpawn, spawnPos, Quaternion.Euler(0, 0, 0), PrefabParent);
77+
GameObject.Instantiate(PrefabToSpawn, spawnPos, Quaternion.Euler(0, 0, 0), PrefabParent).SetActive(true);
7878
PrefabToSpawn = null;
7979
}
8080
}

0 commit comments

Comments
 (0)