Compare commits
No commits in common. "PerformanceV2" and "master" have entirely different histories.
Performanc
...
master
@ -61,7 +61,7 @@ public class BTC : MonoBehaviour {
|
||||
}
|
||||
|
||||
public List<ComponentController> namedObjects = new List<ComponentController>();
|
||||
private Dictionary<int, ComponentController> namedLookup = new();
|
||||
private Dictionary<string, ComponentController> namedLookup = new();
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
@ -95,13 +95,13 @@ public class BTC : MonoBehaviour {
|
||||
foreach (var ctrl in namedObjects)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(ctrl.objectName))
|
||||
namedLookup[ctrl.objectName.GetHashCode()] = ctrl;
|
||||
namedLookup[ctrl.objectName] = ctrl;
|
||||
}
|
||||
}
|
||||
|
||||
public T GetNamedObject<T>(string objectName) where T : ComponentController
|
||||
{
|
||||
if (namedLookup.TryGetValue(objectName.GetHashCode(), out var obj))
|
||||
if (namedLookup.TryGetValue(objectName, out var obj))
|
||||
return obj as T;
|
||||
return null;
|
||||
}
|
||||
|
@ -99,28 +99,15 @@ public class ComponentController : MonoBehaviour {
|
||||
public string roomId;
|
||||
public string uniqueId;
|
||||
|
||||
// cache the name
|
||||
public string _name;
|
||||
public string objectName {
|
||||
get {
|
||||
if (string.IsNullOrEmpty(_name)) {
|
||||
_name = name;
|
||||
}
|
||||
return _name;
|
||||
return name;
|
||||
}
|
||||
set {
|
||||
name = value;
|
||||
_name = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int objectHash {
|
||||
get {
|
||||
return name.GetHashCode();
|
||||
}
|
||||
set {}
|
||||
}
|
||||
|
||||
public virtual void Awake () {
|
||||
UpdateObject();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user