void ChangeSlots(int newSlot) { //Clears old slot. This is the problem. It's always one slot behind. //Also, it doesn't kick the old item out. bPress.selectedSlot = oldSlot; bPress.PickSlot(); bPress.ButtonPress("None"); //Sets the selected time slot to the first one. bPress.selectedSlot = newSlot; bPress.PickSlot(); oldSlot = newSlot; attachedTo = bPress.slctedObj; if (bPress.slctedObj == 1) { this.transform.SetParent(bg1.transform, true); Debug.Log("parented1"); } if (bPress.slctedObj == 2) { this.transform.SetParent(bg2.transform, true); Debug.Log("parented2"); } if (bPress.slctedObj == 3) { this.transform.SetParent(bg3.transform, true); Debug.Log("parented3"); } }
void ChangeSlots(int newSlot) { //Clears old slot. bPress.selectedSlot = oldSlot; bPress.PickSlot(); bPress.ButtonPress("None"); Debug.Log("Cleared Slot"); //Sets the selected time slot to the first one. bPress.selectedSlot = newSlot; bPress.PickSlot(); oldSlot = newSlot; attachedTo = bPress.slctedObj; if (bPress.slctedObj == 1) { this.transform.SetParent(bg1.transform, true); Debug.Log("parented1"); } if (bPress.slctedObj == 2) { this.transform.SetParent(bg2.transform, true); Debug.Log("parented2"); } if (bPress.slctedObj == 3) { this.transform.SetParent(bg3.transform, true); Debug.Log("parented3"); } }