private void OnMouseUp(int buttonId, Vector3 mousePosition) { if (buttonId != 0) { return; } if (lastPressedEntityInfo.pressedEntity != null) { // NOTE: we only process entity as selected if we are not considering that user was holding mouse button to rotate the camera if ((Time.unscaledTime - lastPressedEntityInfo.pressedTime) < DRAGGING_THRESHOLD_TIME) { ProcessEntityPressed(lastPressedEntityInfo.pressedEntity, lastPressedEntityInfo.hitPoint); } } lastPressedEntityInfo.pressedEntity = null; // NOTE: deselect all entities if the user click on the ground and it wasn't holding the mouse left button if (groundClickTime != 0 && (Time.unscaledTime - groundClickTime) < DRAGGING_THRESHOLD_TIME) { if (selectedEntities != null) { OnNoObjectSelected?.Invoke(); } } groundClickTime = 0; }
private void Update() { if (!isDirty) { return; } isDirty = false; SelectionParentReset(); OnSelectedObjectListChanged?.Invoke(selectedEntitiesParent, selectedEntities); if (selectedEntities.Count == 0) { OnNoObjectSelected?.Invoke(); } }