Jump to content

esDotDev

Members
  • Posts

    45
  • Joined

  • Last visited

  • Days Won

    2

esDotDev last won the day on December 4 2015

esDotDev had the most liked content!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

esDotDev's Achievements

Newbie

Newbie (1/14)

4

Reputation

  1. That could be related to our issue, everytime we change an scml, and the prefab is regenerated, SpriterDotNet throws errors. Closing Unity and restarting fixes it. None of our animations use bones.
  2. Awesome thanks, we would really appreciate that! Also, for what it's worth, we're not using any of the advanced featured of Spriter, no MetaData, Sounds, Tags, Events etc, so I was able to get rid of half the garbage by just ignoring calls to GetMetaData completely. Might be cool if the plugin was smart enough to know, hey you aren't using sounds, you aren't using events, etc, and maybe run in a more optimized state? Just a thought. Cheers,
  3. Also, worth mentioning that Dengar's plugin, which converts the SCML to a UnityAnimation, generates absolutely no garbage, no matter how many instances exist in the scene. We switched to DotNet, because it seems better supported and seemed more future-proof solution, but it's really a bummer to see how much memory it's chewing through.
  4. Well it is quite worrying, as with 20 units in the scene, I'm seeing GC times of 8ms on a powerful PC, occuring every 3 seconds. This game will eventually run on PS4 / Vita which have much much weaker CPU's. So, I can't say I have performance issues right now on this PC, but certainly will once they game grows in complexity and runs on weaker machines. And considering I've put a ton of work into the game to remove as much garbage as possible, including object pooling, and optimizing loops and co-routines, it's frustrating to have this massive memory consumption wasting all my hard work. I agree, in general, premature optimization can be a waste, but the code inside this plugin is _extremely_ hot code, it could easily run several thousand times per second at 60fps with many units in the world, so I'd argue that optimizing this inner loop so it doesn't generate much garbage, is not pre-mature, it's a fundamental requirement. Tomorrow I'll try and I get this running on PSVita, and will be able to tell you for sure if we're seeing performance issues, but with 8ms collection time on PC, I'm pretty sure we will. I've looked at the code, and as you say, most of if it instantiation of Dictionaries, which I'm not really sure how to get around at the moment. I think you might have a much better idea on how you could possible cache/pool/reuse these frame objects, so they don't need to be constantly re-created. Another thing I noticed, there's pretty liberal use of for-each loops which (regrettably) are known in Unity to generate garbage because it uses an .NET old compiler.
  5. Testing this in Unity seems to be creating quite a bit of Garbage to be collected. I'd post this in the Unity thread, but any fixes will have to be done on the main lib. It looks like each Spriter instance is generating about 5kb of garbage each frame. You can see from the profiler, ApplySpriteTransform is creating about .5kb, and then GetFrameData and GetFrameMetaData() are creating about 2.1kb each. I'm looking into it now, and will post back if I'm able to reduce it.
  6. Also, one other small but pretty annoying issue, is that whenever the prefab is regenerated, the positioning and scaling info is reset anywhere in the project the prefab is references. I have an archer Game Object, with a nested Spriter Animation, positioned where I'd like him to be within his parent: Archer --> ArcherSpriter (x = -1.78, y=3.16, scaleX: .85, scaleY: .85) Everytime the SCML is reimported, the ArcherSpriter instance resets positioning to 0,0 and scale to 1,1. Any way those could be retained? I also added a bit of functionality to UnitySpriterAnimator, in order to allow me to swap sprites at any time, in any animation: Dictionary<string, Sprite> swappedSprites = new Dictionary<string, Sprite>(); public void UnswapSprite(string name) { if (swappedSprites.ContainsKey(name)) { swappedSprites.Remove(name); } } public void SwapSprite(string name, Sprite sprite) { swappedSprites[name] = sprite; } Sprite GetSprite(Sprite sprite) { if (swappedSprites.ContainsKey(sprite.name)) { return swappedSprites[sprite.name]; } return sprite; } protected override void ApplySpriteTransform(Sprite sprite, SpriterObject info) { .... renderer.sprite = GetSprite(sprite); .... } This allows me to do fun stuff, like make my character blink randomly, regardless of their animation state. spriterAnimator.SwapSprite("eyesOpen", eyesClosedSprite);//Close eyes //Wait 100ms spriterAnimator.UnswapSprite("eyesOpen");//Open Eyes Or, swap his hands randomly, to make it appear as if he's stumming a guitar, regardless of the current animation he's in. (our character can strum guitar while running, standing still, getting hit, etc, and we didn't want to have to bake that in to the animations themselves) //Inside a Coroutine while(true){ spriterAnimator.SwapSprite("chordHand_0", GetRandomChordSprite()); spriterAnimator.SwapSprite("strumHand_0", GetRandomStrumSprite()); yield return WaitForSeconds(tempo); } Doing it this way lets us change the tempo of the strumming to match the music, rather than having it tied to the animation speed. This also allows you an easy way to do character maps, without having to define them in Spriter.
  7. Sure: https://www.dropbox.com/s/k40jec9wb3flxz7/archer.zip?dl=0
  8. I'm getting errors trying to update an SCML file that has already been imported. NullReferenceException: Object reference not set to an instance of an object SpriterDotNet.SpriterProcessor.GetObjectInfo (SpriterDotNet.SpriterAnimation animation, System.String name) SpriterDotNet.SpriterProcessor.AddVariableAndTagData (SpriterDotNet.SpriterAnimation animation, Single targetTime, SpriterDotNet.FrameMetadata metadata) SpriterDotNet.SpriterProcessor.GetFrameMetadata (SpriterDotNet.SpriterAnimation animation, Single targetTime, Single deltaTime, SpriterDotNet.SpriterSpatial parentInfo) SpriterDotNet.SpriterAnimator`2[TSprite,TSound].Animate (Single deltaTime) Steps to reproduce: Import the attached SCML file. Allow SpriterDotNet to create Prefab "ArcherSCML" Open SCML File, rename the entity to "ArcherSCML1", and save. Allow SpriterDotNet to create a new prefab "ArcherSCML1" It should now throw the above error anytime you try and drag either ArcherSCML or ArcherSCML1 into the scene. archer.zip
  9. What's strange about this, at least with my example, is that the keyframe's are all perfect, everything looks absolutely correct within Unity, so the script doesn't appear to have any errors with how it's creating keyframes and placing objects. But there's just this crazy easing going, between the keys, and I can't pinpoint the source of it.
  10. Not sure how much use this will have for the current Spriter2Unity plugin, as what we do now is to churn through the SCML and turn it into a Unity Anim, once they are created they are subject to all limitations and features of standard Unity animations. This would be a much more flexible runtime for SCML files. It's cool, but an entirely different direction than the current plugin. Hopefully someone will step up to the plate to create one.
  11. The DX version is the latest, and it worked fine for our animations, you shouldn't need to do anything special to link the Sprites.
  12. Yep I got it. It just means I need to drag in references to the sprites, into the Unity Editor, in order to perform swapping, rather than just being able to use strings. But that's fine, no big deal. It's probably actually preferable once I get used to it :) A name change would be good, to avoid confusion, and free up that component name if we want to make a true SpriteSwapper in the future. In terms of the bug... it shouldn't be related to registration points. I've fixed them all for this specific SCML file, and they don't change mid-animation or anything, and the other 3 solos all work fine. Lemme know if you'd like a sample of the File. Here's another video showing what it should look like in Spriter, and comparing to Unity: http://screencast.com/t/9VpQwv4gyb
  13. I think I may have found a bug of some sort. 1 of our 11 animations is not playing correctly. For some reason, it's adding extra animations, which are not defined in the keyframes, or present in Spriter. You can see a video here: http://screencast.com/t/t1s7hYmaC Any idea? Looks like it's using some weird non-linear ease.
  14. Woah, didn't expect there to really be a workaround for this, sweet! Doesn't seem to be working properly though, when I combine sprites, they dissapear from the animation. Re-opening the file doesn't seem to help. Looking at the SCML, shows the following: [uPDATE] It seems that simply renaming all the objects, in the Objects Pane works fine. If I just go through every single object_xxx and replace with the proper name, close and restart, it works like a charm.
×
×
  • Create New...