• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by reptilebeats · Jul 02, 2012 at 06:54 PM · uv

moving a uv by one

hi im trying to move a uv of an object by one, so y and x always by 1, can anyone point me in the right direction

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DavidDebnar · Jul 02, 2012 at 07:02 PM 0
Share

Uv's are in the range of 0 to 1..so you can't kind of go for 2 and more for either of x or y axis.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by AlucardJay · Jul 02, 2012 at 07:01 PM

You can try to set the offset of the material using SetTextureOffset :

http://docs.unity3d.com/Documentation/ScriptReference/Material.SetTextureOffset.html

or swap the UV's with a method I described in another question :

http://answers.unity3d.com/questions/274734/play-texture-animation.html

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image reptilebeats · Jul 02, 2012 at 08:14 PM 0
Share

ok comments and answer are back, anyway thanks for clearing that up, i can look into making a small component to move the offset, which is what i actually needed, i was just looking at the wrong thing

avatar image reptilebeats · Jul 02, 2012 at 09:06 PM 0
Share

no luck with with using offset as its applied to all, if i make a new instance of it then it defeats the purpose of an atlas

avatar image AlucardJay · Jul 02, 2012 at 09:16 PM 0
Share

what are you trying to do exactly, it's hard to guess from trying to move a uv of an object by one . Is it for example like a cube, and you wish to swap the UV's on one of the faces only? If you know the verts on the object you wish to change, just change the UVs on those verts .

avatar image reptilebeats · Jul 02, 2012 at 09:32 PM 0
Share

basically i have an atlas sized 4096 and have smaller textures all the same size of 1024, i then apply a tilling to the material of 0.25 after the texture has been resized to 2048.

so all i need to do is move an objects uv 1 accross to the next image in the editor or one up, and so on.

i use another program to do this but its a bit time consu$$anonymous$$g and would like something to suite my needs quickly this is what i started writing

using UnityEngine; using UnityEditor; using System.Collections;

public class UVOffset : EditorWindow {

 string objectSelected;
 Vector2 UVPosition;
 bool applyUVPosition = false;
 
 [$$anonymous$$enuItem("$$anonymous$$G/Window/UVOffset")]
 static void Init(){
     EditorWindow.GetWindow(typeof(UVOffset));
 }
 
 void OnGUI(){
         
     objectSelected = EditorGUILayout.TextField("Object",objectSelected);
     UVPosition = EditorGUILayout.Vector2Field("UV Position",UVPosition);
     applyUVPosition = EditorGUILayout.Toggle("Apply",applyUVPosition);
     
     if(Selection.activeTransform){
         objectSelected = (Selection.activeObject.name);
         
         if(applyUVPosition == true){
             applyUVPosition = false;
                 //Selection.activeTransform.renderer.shared$$anonymous$$aterial.SetTextureOffset("_$$anonymous$$ainTex",new Vector2(UVPosition.x,UVPosition.y));

         }
     
     }
     if(!Selection.activeTransform){
         objectSelected = ("");
     }
     
 }
 
 void OnInspectorUpdate(){
     Repaint();
     
 }

}

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Assigning UV Map to model at runtime 0 Answers

Animating UV transforms in Shader 4 Answers

Efficient way to keep a fixed rotation for sprite? 0 Answers

Why are UVs wrong when building for iPhone? 2 Answers

How to change mesh UV's permanent in Unity (texture atlas) 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges