Jump to content

Dengar

Members
  • Posts

    189
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by Dengar

  1. That's inelegant. Maybe I can rig the importer so it does that when it imports.
  2. Have you tried using a process of elimination to figure out exactly which file or files are causing the problem? I still think this may be a problem with Unity itself, rather than the importer. As for alpha, uhhh, that's the value that determines visibleness right? It doesn't carry that over?
  3. Oh I haven't been dealing with this stuff long enough to know what causes this. A lot of people seem to be able to use it just fine. Even you yourself admit that the problem doesn't occur with every single animation. Here are some guesses 1) Are you absolutely sure that you have imported all of the graphics files before importing the .scml file? 2) If yes, is it possible that one of the files might be corrupt or strange? 3) Are you using any other plugins? Have you tried the Unity forums or Unity Answers? There's a number of users who are experiencing similar issues.
  4. Yes, there is! :) From the menu bar, go to Edit > Project Settings > Editor Set "Default Behavior Mode" to "2D". This should import all textures as Sprites by default.
  5. I am not the original creator, and I can't really speak for them, but I did wonder for myself why the ChangeSprite function is called, not every frame, but every keyframe. I did eventually come to some sort of conclusion, but I will explain that in a bit. First of all, ChangeSprite() is in fact, NOT meant for weapon swapping or skin swapping or anything of the sort, and is not meant to be invoked manually. You see, during the animation, the sprites are not always static. A character may blink, or the graphic for the hand may change from open to closed, etc. In Spriter, you achieve this by changing the texture of one of the objects on a certain keyframe, in the blinking example, you swap the head-with-its-eyes-open for the head-that-is-blinking texture, but only during a single keyframe. When you import a .scml file, the importer goes over every single keyframe of an animation, and maps out which objects (body parts) use what texture for that keyframe, and creates an AnimationEvent for every object in the Sprite to assign that texture to that object for that keyframe (this is also what causes the flicker if you don't patch the importer with my modification, but that has little to do with your current problem). If you want to completely change a body part (or weapon, in your case) completely at runtime, you should not resort to ChangeSprite() (although I understand why you would think so, the name of the function is actually a little bit misleading), since it just resets the texture to its previous state at the next keyframe. This is actually fine. There is an easier and much better way to achieve this. You see, the ChangeSprite() functions draws information from the CharacterMap object itself. Let me break it down: 1) ChangeSprite() is called during a certain keyframe 2) The parameter for ChangeSprite() is a "link" to a variable X inside the CharacterMap 3) Unity applies the texture assigned to variable X to the sprite So if you want to change that texture, just change variable X. Lets say in your example, the default weapon your Sprite is wielding is Sword1.png -Examine the Character Map for your sprite, and find that Sword1.png, you can do this straight from the editor in the inspector -Have your new sword, Sword2.png somewhere in your project -Drag and drop Sword2.png into that value field -Your Sprite should now be wielding that sword in every frame of every animation -Change it back by dragging and dropping Sword1.png back into that field Of course you'd want to change it at runtime. Then you'd have to know the exact index for Sword1.png. It'll look something like [CharacterMap instance].folders[x][y].Sprite. I understand this is very unwieldy, but I'm assuming (and this is a very big assumption but I personally believe it's likely) that the CharacterMap class is actually an unfinished product, and is actually supposed to have a way to change textures more dynamically. Since my own project relies heavily on this functionality, I intend to homebrew something that does this. But since it's just a hobby and I do have a lot of other things to take care of, this might take a while. But maybe you could experiment with it yourself. I hope my explanation is sufficient. I have a hard time explaining all this technical stuff to other people. You probably didn't import all of the associated graphics before importing the .scml file. You have to import the graphic files first, and THEN the .scml file. If that's not the case, then I'm not sure. EDIT: I just remembered, even if you DO import them in the right order, it will show nothing in the previewer while selecting an animation. That is because the animation objects themselves don't contain any graphics. They're just instructions that alter the state of the Prefab's child objects. So what you're experiencing might be normal. If you want to look at the animation, try demo'ing them in Play Mode. You have to attach an Animator component to the Prefab, and then create an Animator Controller and attach it to the Animator. In the Controller, you can just drag and drop the animations, and control them by making transitions. If you want to know more, there are video tutorials on 2D animation in unity everywhere on youtube, and also on the main Unity site. Of course, maybe I could be wrong about all this. I only started poking around in Unity about two weeks ago. I think I'm right about most things though.
  6. The appreciation is appreciated :) Although I really just added a few lines of code to an already amazing tool. I'm also going to work on bringing out the full potential of the character map. Right now it's really "just there". Dunno how long it'll take, it's more of a side project/hobby to me than anything else, but I'll keep you guys posted.
  7. Okay, in your project, in your Assets folder, find: ThirdParty/Spriter2Unity/Scripts/CharacterMap.cs And replace it with this version. Then find: ThirdParty/Spriter2Unity/Editor/Unity/AnimationBuilder.cs And replace it with this version. After that, you will have to re-import your .scml file or it will crash when you go into Play Mode. I added notes to both files so you'll be able to see what I changed and why.
  8. I haven't used any of those other ones. But I can name one difference: Price.
  9. Sorry for the double post but my previous one is several days old, but I really wanted to share this. I added a few lines of code to the importer and it completely got rid of any flicker during transitions. Example: http://dengar.meowcorp.us/test/ Don't mind the second button. That was just me fooling around to figure out how to swap textures at runtime. It wasn't actually that difficult to figure out in hindsight. Most of the time I spent on it was figuring out what the code did, and also how Unity and C# work. Of course I'll share my custom code with anyone who asks. I think I've done most of my preliminary testing and figuring out stuff and working out the kinks, so I can start applying it and work on my actual game project. -- So I just wanna say, I wanna thank both Malhavok and mythgarr (and of course the guys behind Spriter) for giving me as a programmer a chance to work with animations without having to be a good animator or artist.
  10. Regarding the "stutter" when transitioning between animations. Okay so I did some poking around the codes of the importer. From what I understand, the animation periodically updates the sprites used with the data from the character map. Do I understand correctly so far? So what happens is, for a short time while transitioning from one animation to another, both animations will run their "update this-or-that sprite" calls, which causes the stutter. For example, going from "Grey Guy"'s idle animation to his walking animation. The animations use a different texture for the head. The idle animation has the head more or less facing the screen, lets call this sprite 1. The walking animation has the head face more to the side, lets call this sprite 2. The sprite is currently performing the idle animation, so the head is sprite 1. Now, we make the character walk, which will cause it to transition from idle, to walking. This will cause a transition to occur. During this transition (which only lasts a couple hundred ms), both animations are running. At some point, walking will call ChangeSprite() to swap sprite 1 for sprite 2. However, since the we are in middle of a transition, idle animation is still sort-of running. Which means idle's script calls will fire as well. So some milliseconds after sprite 2 has been called in by walking, the still-running idle will suddenly call ChangeSprite() again, and swap the head sprite back for sprite 1. This continues going back and forth until the transition is complete, and only walking will be running, which will swap sprite 2 back in if it hasn't already. Of course, all of the above can be prevented if you just make the transition happen instantaneously, but of course this is inelegant at best, and will just look bad at worst (compared to all the other, much more smooth animation). My question here, is, since I'm quite inexperienced with Unity, is there a way to turn off an animation's script calls while it is transitioning to a new one? That way, in the above example, only walking will be performing any script calls from the transition's start, which means the sprites will change only once. Otherwise there has to be some kind of change in how the animations are converted. Although I can't really think of anything. I hope my explanation and question is clear. EDIT: Is it just me or is the Character Map script largely unfinished? It seems like it has the potential to do so much more than it currently does. Shouldn't it be able to dynamically swap entire texture sets? Not that I have a problem with fliddling around with it myself. The reason I mention this is just in case I overlooked something and someone else is like "Dude, it actually CAN do all those things.". EDIT 2: Okay I really hope I'm not overlooking something here. I'm about to tinker with the plugin itself to see if it can modify the way events work. I don't really want to do any unnecessary things.
  11. After reading this I started messing around with the camera object. Apparently it was set to "Perspective", setting it to "Orthographic" fixed the issue. Thanks for the input, I wouldn't have arrived at this conclusion otherwise. Anyway on to my next question. I'm sorry for so many questions but I'm eager to make this stuff work. Whenever I try to load "Grey Guy"'s idle animation into the animation controller and then go to Play mode, I get this error. Key count: 0 on curve '' UnityEditor.AnimationUtility:GetCurveBindings(AnimationClip) UnityEditorInternal.AnimationWindowState:get_allCurves() UnityEditorInternal.AnimationWindowHierarchyDataSource:FetchData() UnityEditor.TreeView:ReloadData() UnityEditorInternal.AnimationWindowHierarchyDataSource:UpdateData() UnityEditorInternal.AnimationWindowState:Refresh() I get it only once after setting up the animation (maybe it happens when it loads the animation into the controller since it stays there afterward) and there doesn't seem to be anything inherently wrong with the animation other than a slight stutter when it goes from one animation to the next (like idle to walking), but I don't think it's related. I'd really like to know what this error is and if there's a way to avoid it, or whether it's actually as harmless as it initially seems. Speaking of the stutter, any way to avoid that? It seems like during a transition between animations that use different textures, the two textures seem to be "warring" with eachother. Is there any way to make it stop doing that? Without cutting the transition time to 0 of course. Or is this maybe a known issue? I don't mind having to adjust it each time after import if I know how.
  12. Messing with the Z scale does nothing. (I don't think the Z axis even matters in 2D mode) The only thing that does something is manually setting each indiviudal part's "Order in Layer" value. I'm a bit new to unity though so there could be a million things that cause this. But I assure you I haven't really touched any major settings. Although I have been examining the .cs files in the Spriter2Unity folder. Strangely enough I seem to understand most of the stuff that's happening despite being totally unfamilliar with anything C-based. I wonder if I can tweak the script a little to make it set the "Order in Layer" value as the PreFab is being created? Although can that value even be changed before an instance is created? Oh here's another funny tidbit. I've deleted the object and all its assets and reimported the thing several times to see what happens, and one thing stands out. In Scene view, the character looks completely normal. It's only drawn in reverse in Game view. Even when I turn it to 3D mode for a second and rotate around it it still looks the same from the other side, so I don't really think it's a camera thing.
  13. I'm not "drawing" anything. I'm loading the .scml file as is, and then whack it onto the scene. Opening the same file in Spriter gives no problems. It's like Spriter2Unity simply loads the parts in reverse for some reason.
  14. Well even if it's been temporarily discontinued, I have a question. I doun't doubt that there's SOMEONE here who can answer this. The question is simple: I decided to test it out before I start applying its ways to my own projects, so I decided to import the Grey Guy. When I import the .scml file, it imports the animations and everything -almost- alright. I'm able to attach a controller and manipulate the animation. The problem is with the way the Grey Guy is drawn. It draws all the parts in the wrong order, making his head appear behind his torso, etcetera. What I'm wondering is, is there something I did wrong while importing it? Do I have to manually change ALL of the part's layer info so that it will be drawn in the correct order? I can't imagine that no one else has ever run into this problem.
×
×
  • Create New...