Probably because of the order of execution. I’d imagine that Update was called before OnGUI, so the way your code flows wouldn’t work.
In this instance, I wouldn’t break out your code into multiple functions - it’s pretty sloppy! Try re-writing it so everything is done in Update() - the logic behind using OnGUI to do this escapes me, if I’m honest…
If you mean you want it to zoom in on the area between the fingers, then that’s going to be a little more complex. Basically, you’ll need to determine the total change in size (X and Y) and then offset it based on where the center point of the pinch is taking place.
So if the pinch happens in the center, then offset is 0.
If it takes place at the far right edge, then it should be offset toward the left by half the size change value.
Etc.
I think that should work. The trick, of course, is translating that into code.