Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
This question was closed Oct 20, 2016 at 05:47 PM by Guilles for the following reason:

As of now, sprite geometry doesn't seem to be editable, I'll use quads instead.

avatar image
0
Question by Guilles · Aug 09, 2016 at 02:27 PM · editorspriteseditorwindowgeometry

How to override geometry of a procedurally generated sprite in Editor Mode

HI,

I'm trying to develop a 2D tile tool custom editor window and I want it to be able to create non square sprites.

like this:

||

|| || (Imagine each set of two bars is a tile that after gets merged into a single sprite) ||||||

In editor mode I create several tiles from from sprites that I have in the assets folder and then merge them together into a single new texture by copying the pixels from the originals texture. Then I create a sprite using that texture. But when I want to use overrideSpriteGeometry:

"sprite.OverrideGeometry (verts, tris);"

I get this error:

"Not allowed to override geometry on sprite 'MySprite'".

I'm not creating assets files for the texture nor the sprite. The code in general would be like this:

 Texture2D texture = new Texture2D(w,h);
 texture.setPixels(pixelArray);
 texture.apply();

 Sprite Sprite = Sprite.Create (texture , rect, pivot, pixelsPerUnit);
 
 sprite.overrideGeometry(vertices, triangles);

// Then add it to a GameObject

I have tried OnPostprocessSprites with a AssetPostprocessor subclass but it doesn't get called when creating a sprite like this.

¿How can I override the geometry of a sprite that was created this way?

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 vuwij · May 11, 2018 at 11:19 PM 0
Share

Try this

     TextureImporter footprintTextureImporter = (TextureImporter) AssetImporter.GetAtPath(footprintTextureName);
     
     for (int s = 0; s < footprintTextureImporter.spritesheet.Length; ++s) {
     footprintTextureImporter.spritesheet[s].rect.height = footprintTextureImporter.spritesheet[s].rect.height + 3;
                     }

footprintImporter.SaveAndReimport();

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Change the alingment of 2 GUILayout Label 0 Answers

Move objects in scene view before running the game 0 Answers

Unity Editor Event System 1 Answer

Changes to Object made in custom Editor Window don't persist 0 Answers

Keep equal width for panels in EditorGUILayout.HorizontalScope 0 Answers


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