Jump to content

Spriter for Unity 5.0


Dengar
 Share

Recommended Posts

Mike Thanks allot for replying!
No Mike I am just using Basic Animations. 
I have earlier changed the pivot! Now I have used the default pivot to overcome the problem but still the negative scale(flip) is not working the way it should. It's looking really odd. 

one more thing. I am creating a bounce effect for which the scale on bone is not reflecting in the unity.

I don't see any Prefab and animation controller! Then I manually changed all the images to sprite, still no luck. After changing images to sprite I must have to rename the scml file for the changes to appear!

Link to comment
Share on other sites

I've supplied a Spriter walk animation to my colleague who used the spriter to unity importer.  Everything works except one limb. 

 

After reading through this thread I'm guessing it's a problem with me accidentaly animating sprite pivots.  I did not intend to animate the pivots off of the default ones I set, but it's entirely possible id did so by misclicking the sprite instead of the bone.

 

How do I identify if I've accidentily animated the sprite pivot, and if I have, can I repair that part of the animation without redoing the whole sequence?

Link to comment
Share on other sites

I'm pretty sure scaling bones is not yet supported by Spriter2Unity, only rotating and moving.. I could be wrong though.

I suggest you try making a tiny scml with only one small animation testing each feature you want to use (like negative scale for flipping) and see which ones specifically break once imported via Spriter2Unity. This info would be great for yourself, and for others planning to use Spriter2Unity, and for the people currently working on Spriter2Unity so they know what's not yet working/supported properly.

 

cheers,
Mike at BrashMonkey

 

Mike Thanks allot for replying!
No Mike I am just using Basic Animations. 
I have earlier changed the pivot! Now I have used the default pivot to overcome the problem but still the negative scale(flip) is not working the way it should. It's looking really odd. 

one more thing. I am creating a bounce effect for which the scale on bone is not reflecting in the unity.

I don't see any Prefab and animation controller! Then I manually changed all the images to sprite, still no luck. After changing images to sprite I must have to rename the scml file for the changes to appear!

Link to comment
Share on other sites

There's no feature to remove accidentally-changed pivot points.  If you email me your Spriter project, I might be able to examine the scml, figure out where that data is, and manually remove any custom pivot points set in key frames. If you'd like me to try, please zip up the folder with all images used and the scml and email it to mike@brashmonkey.com

 

Cheers.

-Mike at BrashMonkey

 

I've supplied a Spriter walk animation to my colleague who used the spriter to unity importer.  Everything works except one limb. 

 

After reading through this thread I'm guessing it's a problem with me accidentaly animating sprite pivots.  I did not intend to animate the pivots off of the default ones I set, but it's entirely possible id did so by misclicking the sprite instead of the bone.

 

How do I identify if I've accidentily animated the sprite pivot, and if I have, can I repair that part of the animation without redoing the whole sequence?

Link to comment
Share on other sites

I did hastily implement some "compensation" for bone scaling, but I wouldn't surprise me if that didn't fix all the issues concerning bone scaling. Translating bone scaling into Unity is very difficult, trust me.

 

Unity does not have anything that actually behaves like a bone. Empty game objects can pretend to be bones as far as rotation and positioning are concerned. Scaling just cannot be directly translated properly. I'd have to figure out the math that reflects the scaling onto the body parts instead of the "pretend bones". I managed to do part of this, but there might be some variables I have not accounted for.

Link to comment
Share on other sites

 

Posted Yesterday, 01:30 PM

There;s no feature to remove accidentally changed pivot points.  If you email me your Spriter project I might be able to examine the scml, figure out where that data is, and manually remove any custom pivot points set in key frames. If you'd like me to try, please zip up the folder with all images used and the scml and email it to mike@brashmonkey.com

 

Cheers.

-Mike at BrashMonkey

 

Turns out I had not set default pivots on those limb parts.  Didn't cause a problrm within in spriter, but the importer didn't like it.  Simply setting defautlt sprite pivots fixed the problem.  Thanks for the offer of help Mike.

Link to comment
Share on other sites

Ok So what do I do if I want to scale up all graphics? As I told you I was planning to create a bounce effect. 

Ok Alright about it if Spriter didn't support this I will do some trick to achieve this. I am just curious how will I flip my Graphics? Flipping is also not working when importing to unity. definitely it wont, As it's also done in Spriter with a Negative scale ! Right?
 

Link to comment
Share on other sites

Ok So what do I do if I want to scale up all graphics? As I told you I was planning to create a bounce effect. 

Ok Alright about it if Spriter didn't support this I will do some trick to achieve this. I am just curious how will I flip my Graphics? Flipping is also not working when importing to unity. definitely it wont, As it's also done in Spriter with a Negative scale ! Right?

 

 

About scaling: You can just scale the parts instead of the bones without problems.

About flipping: You can do this just fine by using negative scale (on the parts! not on the bones).

Link to comment
Share on other sites

Yeah that's cool but then I need to scale each and every part of my object ! Which is ofcourse I don't want to do. I can do this all in Unity itself. How It's helping me that I can even flip the stuff or scale the whole object, which indeed can be achieved easily by changing Z-Axes and manipulating Scale of parent transform!
One more thing don't you feel that unable to change pivot is also a great problem. I just love spriter for it's super easy and hassle free animation support but I am very disappointed with the unity3d integration. I know that the unity integration assistant plugin is not official but a solid integration will be really helpful.

Link to comment
Share on other sites

Ok Done. I was successful in doing stuff as you guys said. 
One more thing. The Spriter file doesn't ever imports successfully in the first run. I must have to force quit unity then mark all the image assets as Sprites from the Inspector and then have to change the spriter file name to get prefab and animation controller. Is I am the only one facing this? or this is meant to be done this way (there are anomalies which prevent it from importing the way it should).

A BIG Issue. 
Why unity is writing values between keys Frames? I have a pipe. It's x scale is 1 from frame 1 to 200 but Unity it self is setting it's upto 5 between these frames and set's it 1 when you reach 200. why it is so?

Link to comment
Share on other sites

I know the converter is imperfect. I only created it when I was hobbying with code. And I tend to get like into this programming 'mood' only like one or two times a year for a month or two and then it dies down again.

 

 

One more thing. The Spriter file doesn't ever imports successfully in the first run. I must have to force quit unity then mark all the image assets as Sprites from the Inspector and then have to change the spriter file name to get prefab and animation controller. Is I am the only one facing this? or this is meant to be done this way (there are anomalies which prevent it from importing the way it should).

 

It's a known issue but I have not yet examined what might be the cause. I've tried to make my code as readable and easy to work with as I possibly could but only a few people have come up with their own additions.

 

Why unity is writing values between keys Frames? I have a pipe. It's x scale is 1 from frame 1 to 200 but Unity it self is setting it's upto 5 between these frames and set's it 1 when you reach 200. why it is so?

 
I... honestly can't say.
Link to comment
Share on other sites

Thanks allot Dengar for Coming up and replying. I hope I'll find some way to finish!

Still the converter is great and do many thing perfectly. 

One more thing about pivot, why it's can't be translated to unity. I know it's tough to write and translate stuff to unity but just asking to get know how about working. 

Thanks 

Link to comment
Share on other sites

One more thing about pivot, why it's can't be translated to unity. I know it's tough to write and translate stuff to unity but just asking to get know how about working. 

Thanks 

 

Actually when I made the converter I didn't even know you could set non-default pivots. I don't actually think it's too difficult to impliment. It's just addition/subtraction.

Link to comment
Share on other sites

@ Dengar,

 

Perhaps Veltto is talking about Character Maps... meaning to replace the texture set for the entire character to make a different looking character, and not the image swapping feature for the same of an animation.

 

Here is an explanation of the Character Maps feature in Spriter:

 

To my Knowledge Spriter2Unity can't support Character Maps because it simply converts the Spriter animations to native Unity 2d animations (am I mistaken Dengar?)... BUT this would mean any method used to swap texture that works for native Unity 2d animations should work for the ones that were created in Spriter.

 

I found this with a quick google search.. It might be useful to you: https://youtu.be/HM17mAmLd7k?t=27m2s

 

Cheers.

Link to comment
Share on other sites

If I ever get into a programming mood again, character maps are one of the highest things on the priority list. It would only be a quality of life thing though. If you want to reskin an existing sprite, you just write a script that does the following:

 

1) If no sprite swapper is present for that body part, write a script that replaces the texture on the SpriteRenderer component.

2) If there is a sprite swapper, write a script that replaces any of the textures on the SpriteSwapper component. (the SpriteSwapper overrides the SpriteRenderer, so don't use that one)

 

@Mike:

 

The spriter file is converted into a collection of objects: A Prefab object, and a series of Animation objects. The Animation objects only contain curve data. No texture data.

 

Implementing the CharacterMap is not as difficult as it sounds. I (or someone else) just has to translate the CharacterMap data to a C# class and write a script that automatically replaces all the textures on the Prefab. No need to play with the Animations at all.

Link to comment
Share on other sites

  • 2 weeks later...

Hi everyone. Dengar, I am in your debt: I've started a big new project at an established studio, and I was asked to get a pipeline going from Spriter to Unity. Finding the path you and others have already cleared was a huge blessing. Thank you for your hard work, and props to the other folks testing his builds. If I fix or add anything I will post it up.

One "quickie" is the infinite loop people have been dealing with when importing new images. To deal with this, place this file in a Editor folder in your assets. Whenever an image is imported, it checks for the word "spriter" in the path, and then sets the type to Sprite. Adjust to fit. :)

using UnityEngine;using UnityEditor;public class PreProcessTextures : AssetPostprocessor {		void OnPreprocessTexture () 	{		TextureImporter importer = (TextureImporter) assetImporter;		// This is required to avoid occasional infinite loops when importing, as described here:		// 		if (importer.assetPath.ToLower().Contains("spriter"))		{			importer.textureType = TextureImporterType.Sprite;		}	}}
Link to comment
Share on other sites

I... am not quite sure how that works? I mean, the importer should already do this for you. Also, what if the path does not contain the word spriter?

 

That said, if it works for you, as well as for anyone else, it's a decent "quickfix".

 

In addition, if, during your ventures, you make some improvements to the pipeline, I'd like to hear about it.

Link to comment
Share on other sites

I wrote that because I was getting the infinite loop issue when pulling a Spriter project into Unity 5.1.1. Simply force-quitting the app and restarting is not a viable solution, so this alleviates the issue.

 

The check for the "spriter" path is simply a way to control what is set to a Sprite, as opposed to another texture type, since the game we are making will use many types.

 

Currently, I am trying to figure out why an update to the SCML file was not represented in Unity, even after re-importing the SCML file. Taking the prescribed steps (deleting the prefab and controller and reimporting) resolved the issue, but that's a non-starter for a game in full production: that destroys prefab links in the inspector, and destroys all work done with state machines in the animator.

However, the issue only occurred once: I could not reproduce it, and otherwise it worked fine. So that's a bit scary... it would be better if I could repro and fix it.

Work continues!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...