void comButtonClick() { if (RCSBuildAid.Enabled) { /* plugin enabled, CoM button is for toggle marker visibility */ bool visible = !CoM.GetComponent <MarkerVisibility> ().GeneralToggle; CoM.GetComponent <MarkerVisibility> ().GeneralToggle = visible; DCoM.GetComponent <MarkerVisibility> ().GeneralToggle = visible; ACoM.GetComponent <MarkerVisibility> ().GeneralToggle = visible; /* we need the CoM to remain active, but we can't stop the editor from * deactivating it when the CoM toggle button is used, so we toggle it now so is * toggled again by the editor. That way it will remain active. */ Log.Info("comButtonClick, setting to: " + !CoM.activeInHierarchy); CoM.SetActive(!CoM.activeInHierarchy); } if (!RCSBuildAid.Enabled) { /* restore CoM visibility, so the regular CoM toggle button works. */ var markerVisibility = CoM.GetComponent <MarkerVisibility> (); if (markerVisibility != null) { markerVisibility.Show(); } } }
void comButtonClick() { bool markerEnabled = !CoM.activeInHierarchy; /* toggle com */ if (userEnable) { bool visible = !CoM.GetComponent <MarkerVisibility> ().GeneralToggle; CoM.GetComponent <MarkerVisibility> ().GeneralToggle = visible; DCoM.GetComponent <MarkerVisibility> ().GeneralToggle = visible; ACoM.GetComponent <MarkerVisibility> ().GeneralToggle = visible; /* we need the CoM to remain active, but we can't stop the editor from * deactivating it when the CoM toggle button is used, so we toggle it now so is * toggled again by the editor. That way it will remain active. */ CoM.SetActive(markerEnabled); } if (!userEnable && markerEnabled) { /* restore CoM visibility, so the regular CoM toggle button works. */ var markerVisibility = CoM.GetComponent <MarkerVisibility> (); if (markerVisibility != null) { markerVisibility.Show(); } } }