public MBDOInitializationHelper(MonoBehaviour callerAkaThis) { isSetup = false; cardinalSubsystem = null; mbDatabaseObjectReferences = null; caller = callerAkaThis; Setup(callerAkaThis); }
public MBDOInitializationHelper(MonoBehaviour callerAkaThis) { isSetup = default; CardinalObj = default; mbDatabaseObjectReferences = default; caller = default; isCardinal = default; SetupCardinalSubSystem(callerAkaThis); }
public virtual void OnValidate() { if (Application.isEditor) { MBDataObjectReferences mbdoRefs = GetComponent <MBDataObjectReferences>(); if (mbdoRefs != null && mbdoRefs.mbDataObjects.Contains(this) != true) { Debug.LogWarning($"Warning: {this} has not been added to {mbdoRefs}, adding now..."); mbdoRefs.mbDataObjects.Add(this); #if UNITY_EDITOR UnityEditor.EditorUtility.SetDirty(this); UnityEditor.EditorUtility.SetDirty(mbdoRefs); #endif } } }
public void Setup(MonoBehaviour callerAkaThis) { isSetup = true; cardinalSubsystem = null; mbDatabaseObjectReferences = null; caller = callerAkaThis; cardinalSubsystem = GameObject.Find("Cardinal Subsystem"); if (cardinalSubsystem != null) { mbDatabaseObjectReferences = cardinalSubsystem.GetComponent <MBDataObjectReferences>(); if (mbDatabaseObjectReferences == null) { //Debug.Log("mbDatabaseObjectReferences not found in " + cardinalSubsystem); } } else { //Debug.Log("Cardinal Subsystem not found in " + this); } }
public void SetupCardinalSubSystem(MonoBehaviour callerAkaThis) { isSetup = false; CardinalObj = null; mbDatabaseObjectReferences = null; caller = null; if (callerAkaThis.gameObject.scene != new Scene()) { isCardinal = false; isSetup = true; caller = callerAkaThis; GameObject[] gameObjects = GameObject.FindGameObjectsWithTag("Cardinal Subsystem"); foreach (GameObject go in gameObjects) { if (go.scene == caller.gameObject.scene && go.scene != new Scene()) { CardinalObj = go; } } //cardinalSubsystem = GameObject.Find("Cardinal Subsystem"); if (CardinalObj != null) { mbDatabaseObjectReferences = CardinalObj.GetComponent <MBDataObjectReferences>(); if (mbDatabaseObjectReferences == null) { Debug.Log("mbDatabaseObjectReferences not found in " + CardinalObj); } } else { Debug.Log("Cardinal Subsystem not found in " + caller + "'s scene: " + caller.gameObject.scene.name); } } }