Jump to content

Spriter for Unity 5.0


Dengar

Recommended Posts

  • 2 weeks later...

Hello, I am getting the next error. I'm using Unity 5.1.3f and also tried Unity 5.2.0f3

 

Unable to build a prefab for 'test'. Reason: System.NullReferenceException: Object reference not set to an instance of an object
  at Spriter2UnityDX.Prefabs.PrefabBuilder.TryBuild (Spriter2UnityDX.Importing.Entity entity, UnityEngine.GameObject prefab, UnityEngine.GameObject instance, System.String directory, System.String prefabPath, IDictionary`2 folders) [0x0013a] in C:\Users\Alex\Documents\New Unity Project 15\Assets\Spriter2UnityDX\Editor\PrefabBuilder.cs:85
  at Spriter2UnityDX.Prefabs.PrefabBuilder.Build (Spriter2UnityDX.Importing.ScmlObject obj, System.String scmlPath) [0x0014e] in C:\Users\Alex\Documents\New Unity Project 15\Assets\Spriter2UnityDX\Editor\PrefabBuilder.cs:50
UnityEngine.Debug:LogErrorFormat(String, Object[])
Spriter2UnityDX.Prefabs.PrefabBuilder:Build(ScmlObject, String) (at Assets/Spriter2UnityDX/Editor/PrefabBuilder.cs:54)
Spriter2UnityDX.PostProcessing.ScmlPostProcessor:ProcessFiles(IList`1) (at Assets/Spriter2UnityDX/Editor/ScmlPostProcessor.cs:40)
Spriter2UnityDX.PostProcessing.ScmlPostProcessor:OnPostprocessAllAssets(String[], String[], String[], String[]) (at Assets/Spriter2UnityDX/Editor/ScmlPostProcessor.cs:32)
UnityEditor.AssetDatabase:SaveAssets()
Spriter2UnityDX.PostProcessing.ScmlPostProcessor:ProcessFiles(IList`1) (at Assets/Spriter2UnityDX/Editor/ScmlPostProcessor.cs:43)
Spriter2UnityDX.PostProcessing.ScmlPostProcessor:OnPostprocessAllAssets(String[], String[], String[], String[]) (at Assets/Spriter2UnityDX/Editor/ScmlPostProcessor.cs:32)
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets(String[], String[], String[], String[], String[])
UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag(HierarchyProperty, Boolean)
UnityEditor.DockArea:OnGUI()

 

Thanks in advance

 

Alex

Link to comment
Share on other sites

  • 2 weeks later...

Good day all! 

I have this small issue with Spriter2Unity (PS: it's not your fault! It's darn unity's fault). 

I have animated all of my animations now and imported it successfully into Unity. All works well, EXCEPT one small thing:

The animation will be slightly changed in Unity: Look at this example (from my project): http://imgur.com/eVbkWxB

Seems like Unity is trying to "simulate physics" or something. Tried to fiddle around with the animation curve-tangents inside Unity, but I can't get the animations to look exaclty like it does in Spriter.

 

The ONLY work-around I have found so far is: 

1. Find all the parts where the animation doesn't look good inside Unity

2. Go back to Spriter, find the same part in the timeline

3. Spam "key all" button over that part, thus there are soo many keyframes in the animation that Unity can't get the chance to slerp/simulate physics/do random crap

 

I think the problem inside Unity is maybe that all of the keyframe tangents are set to Free Smooth instead of Linear (or something like that).

If anyone (especially you Dengar) have any advice for me, that would be great. As my work-around is very bad if I should decide to go and change parts of the animation (a lot of keyframes to change!)

 

EDIT: even with 100 extra keyframes each 5th millisecond gives some weird artifacts in Unity. It looks better though

Link to comment
Share on other sites

6 hours ago, Pixelpoint said:

Maybe an possible fix for this (so the animation will be identical to how it is in Spriter):

The unity importer script can add keyframes on the entire timeline for that animation inside Unity? Might be hard to do I guess

This could be done manually in Spriter, using the key all button and setting snapping intervals on the timeline, turning snapping on and using Control+2 to move ahead in the animation timeline at set intervals, then clicking the key all to make the keys...after that point, if you change all keys to instant or maybe linear mode (also must be done manually per key-frame, sorry) then your animation should be able to play back fine, IF the problem is the unsupported curve type.

 

All this aside, if the problem is custom curves and you need to use them, might want to look into Loodawrawa's plugin

It also looks like it might be fixed by adjusting the animation controller setup in Unity, which could be blending back to the original pose.

Cheers.

Link to comment
Share on other sites

16 hours ago, Pixelpoint said:

Good day all! 

I have this small issue with Spriter2Unity (PS: it's not your fault! It's darn unity's fault). 

I have animated all of my animations now and imported it successfully into Unity. All works well, EXCEPT one small thing:

The animation will be slightly changed in Unity: Look at this example (from my project): http://imgur.com/eVbkWxB

Seems like Unity is trying to "simulate physics" or something. Tried to fiddle around with the animation curve-tangents inside Unity, but I can't get the animations to look exaclty like it does in Spriter.

 

The ONLY work-around I have found so far is: 

1. Find all the parts where the animation doesn't look good inside Unity

2. Go back to Spriter, find the same part in the timeline

3. Spam "key all" button over that part, thus there are soo many keyframes in the animation that Unity can't get the chance to slerp/simulate physics/do random crap

 

I think the problem inside Unity is maybe that all of the keyframe tangents are set to Free Smooth instead of Linear (or something like that).

If anyone (especially you Dengar) have any advice for me, that would be great. As my work-around is very bad if I should decide to go and change parts of the animation (a lot of keyframes to change!)

 

EDIT: even with 100 extra keyframes each 5th millisecond gives some weird artifacts in Unity. It looks better though

This has something to do with the way Unity interpolates to form a tween. I'm not exactly sure what I can do about it. I have this distinct feeling that there is something I can do thoug.

Link to comment
Share on other sites

  • 3 weeks later...

Hello,

Recently been having some issues with Spriter animations looking different in Unity. Different keyframes and different curves.

The curves are set to linear in Spriter but in Unity they are not linear. Maybe I'm doing something wrong in Spriter/Unity?

Video of issue:

https://youtu.be/KEPUV1w_crc

https://youtu.be/S6Te08rdcEk

 

Wondering if this is a known issue and if there's any workarounds?

I've tried the new beta build but still getting the same issue.

 

Using:

Spriter2UnityDX.unitypackage

SpriterDotNet.Unity.unitypackage

Unity version 5.2.2f1

Spriter Pro - Steam version

Spriter beta - Windows

Link to comment
Share on other sites

Alas, this is where my expertise with Unity's mecanim system ends. I was hoping someone else would get interested in helping out with this aspect by now. :(

This is in fact a known issue, and I do have a feeling there's some kind of fix for it, but at this point in time, I wouldn't know about that.

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

guys i'm experiencing a strange bug:
if i import another asset before Spriter2UnityDX, importing a spriter project to Unity gets stuck on an endless loop towards the end. the only times i succesfully import spriter projects are when the Spriter2UnityDX is first (and the only) asset i imported to my project.

mike told me this "infinite loop" problem was discussed before but i can't seem to find it. so anyone stumbled upon this bug before?

Link to comment
Share on other sites

For the zillionth time, then: I don't know why it happens. I just know it doesn't happen if you manually import the files as Sprite.

 

The biggest problem with bugs and fixing them is that you actually have to be able to reproduce the problem to understand what's causing it.

Link to comment
Share on other sites

Just to follow-up for brand new users, like me, who are running into the "infinite loop" issue when importing a Spriter project into Unity 5.x. I ran into the issue from the start, even when following the video posted by BrashMonkey on how to use the importer. The following steps will CREATE the error in Unity 5.2 or 5.3 when using Spriter r5 (via Steam):

1a) Double-click the Spriter-to-Unity package and select a project, or...

1b) Open Unity, select a project, then Import the package, or...

1c) Open Unity, create a New project, then Import the package, then...

2a)  Drag-and-drop a Spriter project folder into the Assets panel in Unity, or...

2b) Copy-and-paste or move a Spriter project folder into the appropriate Assets folder via Windows Explorer.  

3) Your Unity 5.2.x or 5.3.x project will begin to automatically import the Spriter project, but never complete. It will either appear to reset and attempt to re-import all the sprites over-and-over, or if the project has a single sprite, it will appear stuck at the end of the process and never finish.

To work-around the issue, follow Dengar's point about "manually import the files as Sprite":

1) Perforrm step 1a-c as above.

2) Once the Spriter-to-Unity package appears in your Assets folder in Unity, drag-and-drop or copy the individual sprite images (your .png files) into the Assets panel in Unity. DO NOT simply drag the whole Spriter folder over. Just bring in all the images.

3) Check each image that appears in Unity via the Inspector - each image should be set to Sprite (2D and UI). Click Apply for each image you need to change. For example, if your images came in as Texture Type: Advanced or Texture, you need to change it to Sprite and hit Apply. If you don't hit Apply, it won't re-import the image, so make sure you've done that for EVERY sprite in your Spriter project.

4) Save your project, just in case.

5) In Windows Explorer, go to your Spriter project and drag-and-drop the .scml file into Unity's Asset panel.

6) After a brief amount of processing, you should see that each Sprite now has an accompanying GameObject (e.g. entity_000) with an Animator that contains every animation you made in Spriter. You can drag these objects into your Scene and they will play the default animation when you Play the game. Set up the Animator as normal, to swap animations.

Hope this helps,

M

Link to comment
Share on other sites

I can verify the findings of user @mySprite.

If an image is set to anything else than the "Sprite" format in importing options, this will cause the infinite-loop when importing Spriter projects.

 

HOWEVER!

I made this small script, so that all the images I import to unity from now on is set to the "Sprite" format!

using UnityEngine;
using UnityEditor;

public class TexturePostProcessor : AssetPostprocessor
{

    void OnPreprocessTexture()
    {
        Object asset = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Texture2D));
        if (asset)
            return; 

        TextureImporter importer = assetImporter as TextureImporter;
        
        //Settings that will be applied to the image
        importer.textureType = TextureImporterType.Sprite;
        importer.filterMode = FilterMode.Point;
        importer.textureFormat = TextureImporterFormat.AutomaticTruecolor;
      
    }

}

 

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.

  • Recently Browsing   0 members

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