Matt901 Posted April 28, 2016 Report Share Posted April 28, 2016 Hi Loodakrawa, Been playing around with this for the last couple of hours and it seems like a really useful plugin, so thank you! I'm wondering if there's any support for loading the animations directly into Unity Animations, and in turn, an Animator? I'm looking to take advantage of the Animation Events within them and blend trees. Any insight is greatly appreciated, Thanks Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted April 28, 2016 Author Report Share Posted April 28, 2016 1 hour ago, Matt901 said: Hi Loodakrawa, Been playing around with this for the last couple of hours and it seems like a really useful plugin, so thank you! I'm wondering if there's any support for loading the animations directly into Unity Animations, and in turn, an Animator? I'm looking to take advantage of the Animation Events within them and blend trees. Any insight is greatly appreciated, Thanks Hi, I'm glad you find it useful. Due to the nature of SpriterDotNet it's not really possible to convert everything directly into Unity Animations but the plan is to make it more integrated with Unity. For the time being, you might want to take a look at Dengar's plugin. As for animation events, Spriter supports them natively so that might give you a decent replacement for Unity animation events. And blend trees are one of the planned features. Cheers Quote Link to comment Share on other sites More sharing options...
Thrasher Posted May 16, 2016 Report Share Posted May 16, 2016 Hey Loodakrawa, When I spawn in enemies that use character maps, the basic enemy appears for a moment before the character map gets assigned. Do you know of a way to set this character map before the visuals are displayed? I am setting the character map in the Awake() method for these game objects yet they still appear for a frame before popping to the desired character map. Thanks, James Update: I realized after my post that the sprites are not actually swapped for a character map until SpriterAnimator.Step() is called to animate the entity. I simply added "spriterAnimator.Step(0);" after my "spriterAnimator.PushCharMap()" call and it appears to be working great. Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted May 18, 2016 Author Report Share Posted May 18, 2016 On 16/05/2016 at 5:39 AM, Thrasher said: Hey Loodakrawa, When I spawn in enemies that use character maps, the basic enemy appears for a moment before the character map gets assigned. Do you know of a way to set this character map before the visuals are displayed? I am setting the character map in the Awake() method for these game objects yet they still appear for a frame before popping to the desired character map. Thanks, James Update: I realized after my post that the sprites are not actually swapped for a character map until SpriterAnimator.Step() is called to animate the entity. I simply added "spriterAnimator.Step(0);" after my "spriterAnimator.PushCharMap()" call and it appears to be working great. Yes - it's just a timing issue. Calling Step(0) is a good solution to make it independent of the order of the init methods - I'm also doing that often in my own projects. Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted June 15, 2016 Author Report Share Posted June 15, 2016 Updates: Version 1.5.0 released a while ago Just finished with a massive documentation update - should be up-to-date for every plugin Released the MonoGame plugin as a NuGet package Happy coding! Quote Link to comment Share on other sites More sharing options...
Thiago Romam Posted July 15, 2016 Report Share Posted July 15, 2016 Does SpriterDotNet works with multiples Spriter Projects imported to Unity? I create two different spriter projects and made one entity in each one. Both prefabs were created normally. I also added both to the scene and both animations works. The problem is with the Animator property of the SpriterDoNetBehavior. Scenario: 1. I imported the GreyGuy example to unity. Created a Script for the player to change its animation to hit_0 when an object (like a bullet) would collide with him. Works perfectly. 2. I created a Spriter project and made a Bat entity. I would use it as the bullet for the test 1. I imported the project to unity and added the Bat to the scene. When the bat collided with the GreyGuy, an Exception appear saying that the animation name I used to play in the GreyGuy's animator was not found. After some tests I realized that both GreyGuy and Bat prefabs were sharing the Bat's Animator. Does I need to do something for it to work? I uploaded the full unity project to onedrive: https://1drv.ms/u/s!AmhLdtS8gKjrlrpG9w4jIbN7H_D0bg Thiago Thanks Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted July 15, 2016 Author Report Share Posted July 15, 2016 3 hours ago, Thiago Romam said: Does SpriterDotNet works with multiples Spriter Projects imported to Unity? I create two different spriter projects and made one entity in each one. Both prefabs were created normally. I also added both to the scene and both animations works. The problem is with the Animator property of the SpriterDoNetBehavior. Scenario: 1. I imported the GreyGuy example to unity. Created a Script for the player to change its animation to hit_0 when an object (like a bullet) would collide with him. Works perfectly. 2. I created a Spriter project and made a Bat entity. I would use it as the bullet for the test 1. I imported the project to unity and added the Bat to the scene. When the bat collided with the GreyGuy, an Exception appear saying that the animation name I used to play in the GreyGuy's animator was not found. After some tests I realized that both GreyGuy and Bat prefabs were sharing the Bat's Animator. Does I need to do something for it to work? I uploaded the full unity project to onedrive: https://1drv.ms/u/s!AmhLdtS8gKjrlrpG9w4jIbN7H_D0bg Thiago Thanks It definitely should work with multiple spriter entities. I won't be near my machine with Unity installation for a couple of days to check the project. But, from your description it seems you're trying to play "hit_0" which exists on GreyGuy but not on the bat. Did you perhaps add the PlayerController to the Bat game object? Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted July 15, 2016 Author Report Share Posted July 15, 2016 3 hours ago, Thiago Romam said: ... Just realised what the problem is. You're getting the SdnBehaviour with FindObjectOfType which (as per documentation) "Returns the first active loaded object of Type type." That means it probably finds the one on the Bat and that's why it blows up.https://docs.unity3d.com/ScriptReference/Object.FindObjectOfType.html What you want is: https://docs.unity3d.com/ScriptReference/GameObject.GetComponent.html Quote Link to comment Share on other sites More sharing options...
Thiago Romam Posted July 15, 2016 Report Share Posted July 15, 2016 15 hours ago, loodakrawa said: Just realised what the problem is. You're getting the SdnBehaviour with FindObjectOfType which (as per documentation) "Returns the first active loaded object of Type type." That means it probably finds the one on the Bat and that's why it blows up.https://docs.unity3d.com/ScriptReference/Object.FindObjectOfType.html What you want is: https://docs.unity3d.com/ScriptReference/GameObject.GetComponent.html I didn't saw that. Usually I use GetComponent method for getting scripts in object, but I copied it this way from the SpriterDotNet.Examples. It works now Thanks for your help. Quote Link to comment Share on other sites More sharing options...
Thiago Romam Posted July 15, 2016 Report Share Posted July 15, 2016 How do I define trigger collision for Unity? I set the "Is Trigger" flag for a BoxCollider2D after I imported an object. When I changed the Spriter Project, the entity is reimported and the "Is Trigger" flag loses it's value. Is there a different way to validate collisions when using SpriterDotNet? Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted July 17, 2016 Author Report Share Posted July 17, 2016 On 16/07/2016 at 8:31 AM, Thiago Romam said: How do I define trigger collision for Unity? I set the "Is Trigger" flag for a BoxCollider2D after I imported an object. When I changed the Spriter Project, the entity is reimported and the "Is Trigger" flag loses it's value. Is there a different way to validate collisions when using SpriterDotNet? Hey, you can customise the import process (like setting the Is Trigger flag on colliders) via the EntityImported event. Take a look at the example. Quote Link to comment Share on other sites More sharing options...
DSE Posted August 30, 2016 Report Share Posted August 30, 2016 Hello, I have just updated your lib to the latest (because I wanted the shared assets) from an older one (4+ months) and nearly everything is working perfect. I have noticed that the attack animations on the goblin and girl hero are jerking and don't seem as smooth as they did with the previous version of your lib. Have you experienced this ? Any help is very much appreciated. Thanks, DSE. Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted August 31, 2016 Author Report Share Posted August 31, 2016 5 hours ago, DSE said: Hello, I have just updated your lib to the latest (because I wanted the shared assets) from an older one (4+ months) and nearly everything is working perfect. I have noticed that the attack animations on the goblin and girl hero are jerking and don't seem as smooth as they did with the previous version of your lib. Have you experienced this ? Any help is very much appreciated. Thanks, DSE. Hi, Definitely haven't experienced it - newer versions should be faster, not slower Does it happen with any other animations? Also, are you using Unity or something else? Quote Link to comment Share on other sites More sharing options...
DSE Posted September 1, 2016 Report Share Posted September 1, 2016 Hello, thanks for the reply ! sorry ignore me. I have checked the problem animations in Spriter and its the same. Can I ask, was your older library tweening to smooth out animations which you have now disabled / removed in the latest version ? Thanks again. Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted September 2, 2016 Author Report Share Posted September 2, 2016 5 hours ago, DSE said: Hello, thanks for the reply ! sorry ignore me. I have checked the problem animations in Spriter and its the same. Can I ask, was your older library tweening to smooth out animations which you have now disabled / removed in the latest version ? Thanks again. Now that I think of it - I added caching of frame data. Relevant documentation: https://github.com/loodakrawa/SpriterDotNet#providers The default implementation uses the SnapshotFrameDataProvider which means that instead of calculating the transforms for every frame, this pre-calculates the transforms for the animation with the given interval and uses the closest value when needed. The default interval is 20ms and it should result in a smooth animation but try lowering the value or using the implementation that calculates everything every frame. Let me know if you have any more questions and your results - any feedback helps improve the library. Cheers Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted September 2, 2016 Author Report Share Posted September 2, 2016 5 hours ago, DSE said: Hello, thanks for the reply ! sorry ignore me. I have checked the problem animations in Spriter and its the same. Can I ask, was your older library tweening to smooth out animations which you have now disabled / removed in the latest version ? Thanks again. And now I read this properly - no, my lib never used any additional smoothing. The goal is to have everything look as it looks in Spriter. That being said, everything in Spriter is being interpolated so technically everything should be smooth all the time. Quote Link to comment Share on other sites More sharing options...
Mike at BrashMonkey Posted September 2, 2016 Report Share Posted September 2, 2016 Hi everyone, Keep in mind, some animations are set up to use "instant" keyframes (no tweening interpolation whatsoever), so those can never be silky smooth no matter what code is playing them back. Are you comparing the animation while playing back in Spriter with how they look once in Unity and they are less smooth? -Mike at BrashMonkey Quote Link to comment Share on other sites More sharing options...
Narref Posted October 6, 2016 Report Share Posted October 6, 2016 Hi! Thanks for this amazing project, it is really usefull! I'm using it on Unity 5.5.0b6 and when I add GreyGuy to my project, the player asset doesn't have the references of the sprites and unity set my images as Textuye Type=Default instead of Sprite 2D. I don't know what i'm doing wrong. EDIT: I fixed it by selecting the sprites manually on the player.asset. Is there a way to select them manually? Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted October 10, 2016 Author Report Share Posted October 10, 2016 On 06/10/2016 at 8:18 PM, Narref said: Hi! Thanks for this amazing project, it is really usefull! I'm using it on Unity 5.5.0b6 and when I add GreyGuy to my project, the player asset doesn't have the references of the sprites and unity set my images as Textuye Type=Default instead of Sprite 2D. I don't know what i'm doing wrong. EDIT: I fixed it by selecting the sprites manually on the player.asset. Is there a way to select them manually? You probably created the project as 3D instead of 2D so Unity imports images as something other that Sprite. So either create this as a 2D project or change the default import type for images (I don't know if this is actually possible). Quote Link to comment Share on other sites More sharing options...
Narref Posted October 10, 2016 Report Share Posted October 10, 2016 5 hours ago, loodakrawa said: You probably created the project as 3D instead of 2D so Unity imports images as something other that Sprite. So either create this as a 2D project or change the default import type for images (I don't know if this is actually possible). Awesome! I tested it on an old project and I didn't know it was created as 3D. Thanks for your answer, its working perfect now!! Quote Link to comment Share on other sites More sharing options...
Noxalus Posted October 25, 2016 Report Share Posted October 25, 2016 Hello everyone! I'm a real beginner with Spriter (and with animation in general), I discovered it some days ago, but I would like to use it for a MonoGame project on Android and I have some newbie question. - Is it possible with Spriter to combine multiple animations? Let's say that we have a character with a "walk" animation and an "eyes blink" animation, is it possible to play both simultaneously? As a matter of fact, I would like to play the "eyes blink" animation independently, no matter what is the animation that is currently playing. - Is it possible to get the world position of a part of an animation? Let's say that we have a character waving arms, is it possible to get the position of the end of the left arm for example? - Is it possible to attach bouding boxes to every parts of the sprite so that the transformations (translation, rotation and scale) applied to the sprite are also applied to the bounding boxes? I'm sorry if the questions are really dumb, but I need to know if these 3 points can be achieved with Spriter and the MonoGame extension. Thanks in advance Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted October 25, 2016 Author Report Share Posted October 25, 2016 13 hours ago, Noxalus said: Hello everyone! I'm a real beginner with Spriter (and with animation in general), I discovered it some days ago, but I would like to use it for a MonoGame project on Android and I have some newbie question. - Is it possible with Spriter to combine multiple animations? Let's say that we have a character with a "walk" animation and an "eyes blink" animation, is it possible to play both simultaneously? As a matter of fact, I would like to play the "eyes blink" animation independently, no matter what is the animation that is currently playing. - Is it possible to get the world position of a part of an animation? Let's say that we have a character waving arms, is it possible to get the position of the end of the left arm for example? - Is it possible to attach bouding boxes to every parts of the sprite so that the transformations (translation, rotation and scale) applied to the sprite are also applied to the bounding boxes? I'm sorry if the questions are really dumb, but I need to know if these 3 points can be achieved with Spriter and the MonoGame extension. Thanks in advance Hi! I'm also using it with MonoGame and Android so that means this mode is always actively updated - It is possible to combine multiple animations (2 atm). Just read the docs (relevant section) - You can achieve the desired behaviour by using "Action Points". Also, take a look at the MonoGame example project - it is just drawing the points but it can serve as a good example. - I don't see why not. All the transforms do get applied to bounding boxes. Also take a look at the example project - same thing. Cheers Quote Link to comment Share on other sites More sharing options...
Noxalus Posted October 26, 2016 Report Share Posted October 26, 2016 Thanks a lot for your answer @loodakrawa, now I know it's possible, I will start testing Quote Link to comment Share on other sites More sharing options...
dcaudill724 Posted October 31, 2016 Report Share Posted October 31, 2016 Hi, I've been developing a small video game in MonoGame and I'm working on using the MonoGame plugin but I'm caught up on a few parts. Steps 2 and 3 are super easy but when I reach step 4 I get confused. Step 4 states: "Instantiate a DefaultProviderFactory". As this is a generic class I am not quite sure which types should be used for my Spriter animations and what to put for TSound if I have no sound with my sprite. Also, I get even more confused when I reach steps 5. Step 5 states: "Load the required TSprites and TSounds based on the FolderId/FileId from the Spriter instance and register them with the DefaultProviderFactory". I am really lost on what FolderId and FileId are and how to properly use them. I would really appreciate it if someone could point me in the right direction or maybe even teach me a little bit about this plugin.Thank you. Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted November 1, 2016 Author Report Share Posted November 1, 2016 5 hours ago, dcaudill724 said: Hi, I've been developing a small video game in MonoGame and I'm working on using the MonoGame plugin but I'm caught up on a few parts. Steps 2 and 3 are super easy but when I reach step 4 I get confused. Step 4 states: "Instantiate a DefaultProviderFactory". As this is a generic class I am not quite sure which types should be used for my Spriter animations and what to put for TSound if I have no sound with my sprite. Also, I get even more confused when I reach steps 5. Step 5 states: "Load the required TSprites and TSounds based on the FolderId/FileId from the Spriter instance and register them with the DefaultProviderFactory". I am really lost on what FolderId and FileId are and how to properly use them. I would really appreciate it if someone could point me in the right direction or maybe even teach me a little bit about this plugin.Thank you. Hi, I'm glad to hear there's more love for MonoGame out there I'll update the MonoGame specific documentation soon since I added quite a few helpers and the documentation you're referring is the generic one (since the lib can be used with any framework). The easiest way to make it work for MonoGame is: Build the SpriterDotNet.MonoGame.Importer project Add a reference to the built .dll in MonoGame's content file for your game - something like this Instantiate a DefaultProviderFactory<Sprite, SoundEffect> Instantiate a SpriterContentLoader invoke the fill method of the SpriterContentLoader passing the factory from step 3 You can see all this in action in the example project, or in this class to be more specific. Alternatively, if you want the bare bones version (not using any caching, texture sharing, etc): Read the .scml data into a string Get a Spriter instance with SpriterReader.Default.Read Instantiate a MonoGameAnimator passing the Entity you want animated (from the Spriter in step 2) + null for factory Iterate over all SpriterFolder/SpriterFile in Spriter and load them as Texture2D/SoundEffect MonoGame types * wrap all Texture2D in a Sprite instance (like so) Register all data from step 4. with SpriteProvider/SoundProvider properties on the animator from step 3 Call Update and Draw on the animator There you go, hopefully that can get you started. All of this might sound a bit overly complicated but it comes with a bunch of optimisations out of the box and allows you to customise almost every detail. You can find more about that here. Let me know if you managed to make it work or if any steps were not clear (so I can add this to the docs). Cheers Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.