Material doesn't have a texture property '_RendererColor'

I want to scroll ball texture to show its moving so I have written this kind of code:

// ball texture rolling
textureOffset.x -= myRigidBody.velocity.normalized.z * (speed / 500f);
textureOffset.y = myRigidBody.velocity.normalized.x * (speed / 40);
myMaterial.mainTextureOffset = Vector2.Lerp (myMaterial.GetTextureOffset (1), textureOffset, speed * Time.fixedDeltaTime);

I was getting this kind of error during game play in Unity Editor.
124550-unity-error.png

This kind of material assigned to ball object:
124551-ball-material.png

I have just upgraded Unity version 2017.3.1p4 and error started coming, I don’t know what to do now. Give me suggestions to solve this.

It looks like you’ve just been very “lucky” so far.

myMaterial.GetTextureOffset (1)

… is a particularly illogical call to make. Check out the documentation on the function. You can either feed in the texture name (likely “_MainTex”) or for better efficiency, you can feed in a nameID, obtained using Shader.PropertyToID() (again, likely using “_MainTex”).

Shader variable “numbers” aren’t necessarily going to be consistent, so you should always make sure you’re using the correct one by the correct name.