private void Update() { if (lastFramePickedUp != IsPickedUp) { changeMaterial.ChangeMaterials(); } lastFramePickedUp = IsPickedUp; if (!IsPickedUp) { return; } target = pickUpPoint.transform.position; distance = Vector3.Distance(target, transform.position); if (distance > maxDistance && IsPickedUp) { Drop(); } }