Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 Xerosigma · Jun 20, 2012 at 10:21 PM · c#uvuv mappinguv coordinates

C# PackTextures & UV Mapping

I'm a tad bit confused as to how to work with the mesh and the uvs. At a loss in RegenerateUVS(). Is there a good example of this in action? Is there a way for me to see the changes to the UV live as to make it easier to modify?

I'm getting the Rect[] back in uvs but I'm not sure how to cross reference that with the old uvs to get the new coords. It's only five elements with four values for each. (X,Y,Width,Height)

I'm looking at this at the moment: http://unity3d.com/support/documentation/ScriptReference/Mesh-uv.html

I'm not sure if the calculation I made are being applied or not but if they are, it's resulting in the same uvs.

Green is still the head which is fine. But the others are out of wack.

Red should be body, purple should be feet, blue hands, and orange for pants.

125alt text125

Comment
Add comment
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

2 Replies

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

Answer by Wolfram · Jun 21, 2012 at 12:43 PM

About the error: When calling new Material() with a string, the string is parsed as Shader source code (see documentation), but you are passing "0.0"

Other things: PackTextures() returns an array of UVs in the order of/matching the incoming Texture array. However,

  • you are calling PackTextures in Awake() and assigning the return value to "uvs", which is good. But you alre also calling PackTextures in Update(), ignoring the return value. Is this intentional?

  • With SetAssembly() you are arranging your Texture array. However, you are then assigning the corresponding uvs.Rect[] to MeshFilters using the same indexing, but you gathered your MeshFilters with GetComponentsInChildren, which return Components in a differently sorted or even random order.

Comment
Add comment · Show 1 · 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 Xerosigma · Jun 21, 2012 at 06:50 PM 0
Share

@Wolfram $$anonymous$$resse Thanks for your answer, I got the error to disappear and the Update() PackTextures() was intentional. $$anonymous$$aking live character customization. And thanks for the analyses of my script, helped be organize it way better!

avatar image
0

Answer by Xerosigma · Jun 21, 2012 at 06:49 PM

I managed to figure it out. I was told by a well experienced Unity developer that I was not able to change the PackTextures() build order, which was false. As such I never attempted to actually change it to see if I could get it to match my mesh.

Turns out I could and did, now the my UVS are showing correctly.

Comment
Add comment · 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

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.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Is it possible to UV map a cylinder without duplicating a column of vertices? 1 Answer

UV Tiling/repeat 1 Answer

How can I convert the texture coordinates of the multi-spite to 0-1? 0 Answers

Procedural Mesh UV problem 0 Answers

Multiple Cars not working 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