The member `UnityEngine.Material.mainTextureOffset' cannot be used as method or deleg

I have the following line in a GUI not attached to the object and in a script attached to the object. Except i’m specifying the GameObject in the GUI version.

renderer.material.mainTextureOffset ("_Mask", new Vector2(0, SHADEVALUE));

In the GUI where I tested it it works fine. When I attach it to an object i’m getting the following error…

“The member `UnityEngine.Material.mainTextureOffset’ cannot be used as method or deleg”

the shade value is controlled from a slider, and in the script I’m referencing the interface.

UserInterface userInterface = (UserInterface)GameObject.Find("FPSPlayer").GetComponent(typeof(UserInterface));
SHADEVALUE = userInterface.shadeValue;
renderer.material.mainTextureOffset ("_Mask", new Vector2(0, SHADEVALUE));

what is wrong and why am I getting this error? Thanks.

The “mainTextureOffset” code only accepts one parameter, a Vector2. If you want to specifically use the “_Mask” texture, you’ll want to use “SetTextureOffset” or if the mainTexture is _Mask, you can just remove the “_Mask” part.

You’re calling it like a function. You’re supposed to just use =.