public void CopyModelTo(LowPolyModel other) { Component[] theseComponents = this.GetComponentsInChildren <Component>(true); Component[] otherComponents = other.GetComponentsInChildren <Component>(true); int numLRs = theseComponents.Length; if (otherComponents.Length == numLRs) { for (int i = 0; i < numLRs; i++) { LowPolyModelValues.CopyFromTo(theseComponents[i], otherComponents[i]); } } else { Debug.Log("Numcomponents error"); } other.changeCount = changeCount; }
public override void OnInspectorGUI() { base.OnInspectorGUI(); LowPolyModel lpm = target as LowPolyModel; EditorGUILayout.LabelField("ChangeCount: " + lpm.changeCount); if (lpm.referenceModel != null) { if (GUILayout.Button("Apply changes to reference")) { lpm.CopyModelTo(lpm.referenceModel); } } else { if (GUILayout.Button("Send changes")) { lpm.changeCount++; } } }
public bool ValuesEquals(LowPolyModel other) { Component[] thisComponents = this.GetComponentsInChildren <Component>(true); Component[] otherComponents = other.GetComponentsInChildren <Component>(true); int numComponents = thisComponents.Length; if (otherComponents.Length != numComponents) { return(false); } else { for (int i = 0; i < numComponents; i++) { if (LowPolyModelValues.Equality(thisComponents[i], otherComponents[i]) == false) { return(false); } } } return(true); }