- Home /
How to access the ofset of a material
I have a private Vector2 offset = Vector2.zero
When I want to assign the offset variable I have to directly call the matieral like this
offset = material.GetTextureOffset("string") what shoud I put in the string cuz i have tried the texture name,the material name ecc. Thank you
Answer by tanoshimi · Jul 07, 2015 at 11:01 AM
You put in the texture name of which you want to retrieve the offset. So, if you want to retrieve the offset of the main texture (which is normally called "_MainTex"):
offset = material.GetTextureOffset("_MainTex");
(you could also just use material.mainTextureOffset
)
If you want to retrieve the normal map offset:
offset = material.GetTextureOffset("_BumpMap");
etc. etc.
Your answer
![](https://koobas.hobune.stream/wayback/20220611230147im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Scroll Ball Texture Smoothly 0 Answers
DAY and NIGHT Texture on Planet Earth 0 Answers
Material offset relative to other game object 0 Answers
Mirror reflecting another mirror ... 1 Answer