Hello,
I’m making a Neural Network modeling program, and I’ve already made a tiled Image for my background grid.
I’m trying to change Image Pixels per Unit Multiplier via code, which doesnt work (Editing it via editor in runtime works just fine)
Here’s my code for Zoom In/Out:
float desiredSize = this.GetComponent<Camera>().orthographicSize;
desiredSize -= Input.mouseScrollDelta.y * 3;
//Clamp between min and max
desiredSize = Mathf.Clamp(desiredSize, minSize, maxSize);
//Smoothly interpolates to desired size
this.GetComponent<Camera>().orthographicSize = Mathf.Lerp(this.GetComponent<Camera>().orthographicSize, desiredSize, 5f * Time.deltaTime);
//Change pixels per unit multiplier to half of camera’s size (with only 1 decimal char)
gridImage.pixelsPerUnitMultiplier = Mathf.Round( (this.GetComponent<Camera>().orthographicSize / 2) * 10f) / 10f;
It changes the value of pixels per unit just as intended, but it doesnt seems to have any effect on the Image itself.