Script to change variable based on conditions

image

Hello!

I am new to Unity and been trying to create a scene where a shader’s properties change based on specific conditions.

This shader has two variables, one being the rotation count and the other a texture offset. I want both to change proportionally to the Y-axis size value of a third object.

So for instance, if that object has a y-size of 3, RotationCount changes by say 3.

I’ve tried my best to create a script that changes the values by referencing these properties, however I can’t get it to work…

Would a more experienced user please guide me with the correct approach here?

Thank you!