void AddClusterScripts(GameObject iObject, bool iChildren) { //MiddleVRTools.Log("AddCluster to " + iObject); //print("AddCluster to " + iObject); { if (iObject.GetComponent <VRShareTransform>() == null) { VRShareTransform script = iObject.AddComponent <VRShareTransform>() as VRShareTransform; script.Start(); } if (iObject.GetComponent <VRApplySharedTransform>() == null) { VRApplySharedTransform script = iObject.AddComponent <VRApplySharedTransform>() as VRApplySharedTransform; script.Start(); } } if (iChildren == true) { foreach (Transform child in iObject.transform) { GameObject childObject = child.gameObject; //print("Child : " + childObject); AddClusterScripts(childObject, true); } } }
void AddClusterScripts(GameObject iObject) { MiddleVRTools.Log(2, "[ ] Adding cluster sharing scripts to " + iObject.name); if (iObject.GetComponent <VRShareTransform>() == null) { VRShareTransform script = iObject.AddComponent <VRShareTransform>() as VRShareTransform; script.Start(); } if (iObject.GetComponent <VRApplySharedTransform>() == null) { VRApplySharedTransform script = iObject.AddComponent <VRApplySharedTransform>() as VRApplySharedTransform; script.Start(); } }
private void EnableOrDisableClusterScripts(bool iEnabling, GameObject iObject, bool iChildren) { string enableOpStr = (iEnabling ? "[ ] Enabling" : "[ ] Disabling"); MVRTools.Log(enableOpStr + " cluster on " + iObject); VRShareTransform shareTransformObj = iObject.GetComponent <VRShareTransform>(); if (shareTransformObj != null) { shareTransformObj.enabled = iEnabling; MVRTools.Log(enableOpStr + " cluster on " + iObject + " with VRShareTransform."); } if (iChildren == true) { foreach (Transform child in iObject.transform) { GameObject childObject = child.gameObject; EnableOrDisableClusterScripts(iEnabling, childObject, true); } } }
// Use this for initialization public void Start () { m_STScript = (VRShareTransform)GetComponent("VRShareTransform"); }
// Use this for initialization public void Start() { m_STScript = (VRShareTransform)GetComponent("VRShareTransform"); }