public void Start() { cacheRB = GetComponent <Rigidbody>(); cacheRB.isKinematic = true; if (fragControl == null) { fragControl = transform.parent.parent.GetComponent <FraggedController>(); } GetComponent <Renderer>().enabled = false; fragControl = gameObject.transform.parent.parent.GetComponent <FraggedController>(); forceMax = (int)(fragControl.forceMax * fragControl.fragMass); forceMin = (int)(fragControl.forceMin * fragControl.fragMass); sRot = transform.rotation; sPos = transform.position; sScale = transform.localScale; cacheRB.mass = fragControl.fragMass; }
public override void OnInspectorGUI() { FraggedController target_cs = (FraggedController)target; DrawDefaultInspector(); if (GUILayout.Button("Change Fragment Materials")) { target_cs.fragments = target_cs.transform.Find("Fragments"); target_cs.ChangeMaterials(); target_cs.fragMaterials = null; } if (GUI.changed) { EditorUtility.SetDirty(target_cs); } }