Problem: Team marker centering was changing zoom level instead of preserving it.
Fix: Modified CenterOnTeamMarker() to preserve current zoom level:
// Before: targetZoom = focusZoomLevel;
// After: targetZoom = cam.orthographicSize; // Keep current zoom
Added: Better error handling with fallback to find team marker by name if normal method fails.
Problem: Full map positioning wasn't accounting for tile scaling.
Fix: Updated ZoomToFullMap() to properly use MapVisualizer.tileSize:
// Before: Simple map dimensions without scaling
targetPosition = new Vector3(mapData.Width / 2f, y, mapData.Height / 2f);
// After: Proper world coordinates with tile scaling
targetPosition = new Vector3(
(mapData.Width * tileSize) / 2f,
transform.position.y,
(mapData.Height * tileSize) / 2f
);
Problem: MapVisualizer.PositionCameraToMap() was overriding camera zoom settings.
Fix: Modified MapVisualizer to preserve user's zoom level:
// Before: Always set camera size
mainCam.orthographicSize = Mathf.Max(requiredHeight, requiredWidth, 80f) + 20f;
// After: Only adjust if camera zoom is too small
if (mainCam.orthographicSize < suggestedSize) {
mainCam.orthographicSize = suggestedSize;
}
Added: Debug logging to track zoom limit behavior.
Problem: Centering was forcing a specific zoom level. Fix: Changed to preserve current camera zoom level when centering on team marker.
Team Marker Centering:
Full Map View:
Enhanced Zoom Range:
Preserved Settings:
All fixes are in the MMCameraController.cs and MapVisualizer.cs files. The camera system should now work smoothly without the reported issues.