loodakrawa Posted December 5, 2015 Author Report Share Posted December 5, 2015 On 4/12/2015, 2:21:17, exkyo87 said: i zip the file because it was larger than the forum max total size what it's really strange is that when i create a collision in the spriter when i reopen the file it disappear.. EDIT: my file have 3 entity, what i see that the problem of the disappear collision in Spriter is something about the entity1 because in the entity0 it doesn't happen, i tested in the entity0 creating two collision after the first frame in the timeline, they are added in unity but for some reason they appear too small in runtime, scale x and y 0.0001. loli_000.zip There seems to be an issue with attachments on the forum - I can't access it. Can you please upload it to an external location and provide the link Quote Link to comment Share on other sites More sharing options...
Gears94 Posted December 5, 2015 Report Share Posted December 5, 2015 This is really amazing and being new to spriter and unity (was using ue4 but switched to unity for the easier programming in c# with unity) and also programming lol this is very helpful and would like to thank you for taking the time to make this and improve it. I also wanted to use spritelamp with my animations and after a bit of googling for how i might be able to do this (which is simple to do i know but im still very new to programming so i had to google a bit lol) I was able to come up with these lines of code added to UnitySpriterAnimator.cs inside the method ApplySpriteTransform Material newMat = Resources.Load("Materials/" + sprite.name, typeof(Material)) as Material; if (newMat) { renderer.material = newMat; } which is working so far but the limitations of this is the fact that you have to create the resource folder then the material folder(which is an optional folder but would need to removed from the code if not used) in the resources folder then I place the material in that folder which will need to be named the same as the sprite. Was wondering if you think there is a better way of doing this. Not having the resource folder or materials made will just work like normal and attach the default sprite material. Its late so i have not done a full animation with all parts with their own materials but i did just 2 parts of a simple animation i did and it seems to be working fine. Quote Link to comment Share on other sites More sharing options...
exkyo87 Posted December 5, 2015 Report Share Posted December 5, 2015 12 hours ago, loodakrawa said: There seems to be an issue with attachments on the forum - I can't access it. Can you please upload it to an external location and provide the link I upload the file again with the resources files here:http://www41.zippyshare.com/v/svi4PlAy/file.html I'm getting some strange error when trying to import the project in unity: ArgumentNullException: Argument cannot be null. Parameter name: source for test i create a collision in the attack01 animation frame 454, there is a "myBox" collision rectangle Also try to verify in a new project creating some collision boxes or something (maybe later in the timeline?) if something is wrong with the size of the BoxCollider2d because i can see the boxes but with very small size. EDIT: i did some test about this in a new project creating two collisions after the first frame in the timeline, and one of this two boxes has an y size of 0.0001 this is the scml file if you want to give it a look:http://www90.zippyshare.com/v/ha1rIXj4/file.html (it use the same resources of the other file) Hope this help, if you need anything else let me know Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted December 7, 2015 Author Report Share Posted December 7, 2015 On 5/12/2015, 7:20:28, Gears94 said: This is really amazing and being new to spriter and unity (was using ue4 but switched to unity for the easier programming in c# with unity) and also programming lol this is very helpful and would like to thank you for taking the time to make this and improve it. I also wanted to use spritelamp with my animations and after a bit of googling for how i might be able to do this (which is simple to do i know but im still very new to programming so i had to google a bit lol) I was able to come up with these lines of code added to UnitySpriterAnimator.cs inside the method ApplySpriteTransform Material newMat = Resources.Load("Materials/" + sprite.name, typeof(Material)) as Material; if (newMat) { renderer.material = newMat; } which is working so far but the limitations of this is the fact that you have to create the resource folder then the material folder(which is an optional folder but would need to removed from the code if not used) in the resources folder then I place the material in that folder which will need to be named the same as the sprite. Was wondering if you think there is a better way of doing this. Not having the resource folder or materials made will just work like normal and attach the default sprite material. Its late so i have not done a full animation with all parts with their own materials but i did just 2 parts of a simple animation i did and it seems to be working fine. I'm not familiar with spritelamp but if you need to load something like this you should probably do it during import time. There's an event that get called after the import. Take a look here. Quote Link to comment Share on other sites More sharing options...
Gears94 Posted December 7, 2015 Report Share Posted December 7, 2015 Thanks Ill take a look at that. Spritelamp is used to create a normal map for a 2d sprite for lighting in a game engine and they have a shader plugin that goes along with it and it also generates other maps as well but the main one you need is the normal map. The reason I like the way you get the animation into unity is because it keeps all the body pieces separate and I wouldn't have to create a normal map for each frame of the animation just each body piece which of course would save a ton of time. Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted December 7, 2015 Author Report Share Posted December 7, 2015 On 6/12/2015, 4:17:50, exkyo87 said: I upload the file again with the resources files here:http://www41.zippyshare.com/v/svi4PlAy/file.html I'm getting some strange error when trying to import the project in unity: ArgumentNullException: Argument cannot be null. Parameter name: source The import issue was due to an completely blank animation - will fix that. Other that that, it blows up during one of the animations. Did you edit the .scml manually? Because based on the error it's either a manual modification error or a spriter bug (or undocumented feature). For future reference: <key id="3" time="350"> <bone_ref id="0" timeline="0" key="3"/> <object_ref id="19" timeline="0" key="3" z_index="19"/> </key> <key id="3" time="350" spin="-1"> <bone x="10.99669" y="434.393979" angle="61.467489"/> </key> Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted December 7, 2015 Author Report Share Posted December 7, 2015 On 6/12/2015, 4:17:50, exkyo87 said: for test i create a collision in the attack01 animation frame 454, there is a "myBox" collision rectangle Also try to verify in a new project creating some collision boxes or something (maybe later in the timeline?) if something is wrong with the size of the BoxCollider2d because i can see the boxes but with very small size. EDIT: i did some test about this in a new project creating two collisions after the first frame in the timeline, and one of this two boxes has an y size of 0.0001 this is the scml file if you want to give it a look:http://www90.zippyshare.com/v/ha1rIXj4/file.html (it use the same resources of the other file) Hope this help, if you need anything else let me know This happens because one of the boxes has a negative size which makes no sense so I suppose this is Spriter bug - could you please report it?. <obj_info name="box_001" type="box" w="196" h="-88" pivot_x="0" pivot_y="0"/> Quote Link to comment Share on other sites More sharing options...
exkyo87 Posted December 7, 2015 Report Share Posted December 7, 2015 11 hours ago, loodakrawa said: The import issue was due to an completely blank animation - will fix that. Other that that, it blows up during one of the animations. Did you edit the .scml manually? Because based on the error it's either a manual modification error or a spriter bug (or undocumented feature). For future reference: <key id="3" time="350"> <bone_ref id="0" timeline="0" key="3"/> <object_ref id="19" timeline="0" key="3" z_index="19"/> </key> <key id="3" time="350" spin="-1"> <bone x="10.99669" y="434.393979" angle="61.467489"/> </key> yes, i did some changes in the xml manually, deleting the boxes that didn't show up in Unity or Spriter, gonna check. I will recreate the animations again in a new project to avoid more strange errors 8 hours ago, loodakrawa said: This happens because one of the boxes has a negative size which makes no sense so I suppose this is Spriter bug - could you please report it?. <obj_info name="box_001" type="box" w="196" h="-88" pivot_x="0" pivot_y="0"/> ok, i'll report this bug. EDIT:The problem of the boxes happens when you draw the box with the alt from the bottom side to the top, i already reported it Thanks for the help! Quote Link to comment Share on other sites More sharing options...
exkyo87 Posted December 10, 2015 Report Share Posted December 10, 2015 On 7/12/2015 at 3:03 AM, loodakrawa said: The import issue was due to an completely blank animation I don't know if its related, but i was creating a new project, and i found that if you create an animation without bones, when you drop the prefab in the scene, Unity can't find the sprite you use in Spriter (the first time, if you save adding a bone in Spriter, go to Unity, then remove the bone, it shows properly) i dont know why anyone will create an animation without bones, but i thought it will be a good idea let you know about that Quote Link to comment Share on other sites More sharing options...
esDotDev Posted December 10, 2015 Report Share Posted December 10, 2015 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. Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted December 10, 2015 Author Report Share Posted December 10, 2015 1 hour ago, exkyo87 said: I don't know if its related, but i was creating a new project, and i found that if you create an animation without bones, when you drop the prefab in the scene, Unity can't find the sprite you use in Spriter (the first time, if you save adding a bone in Spriter, go to Unity, then remove the bone, it shows properly) i dont know why anyone will create an animation without bones, but i thought it will be a good idea let you know about that I'll investigate this ASAP. Thanks for reporting it Quote Link to comment Share on other sites More sharing options...
hippyman Posted December 25, 2015 Report Share Posted December 25, 2015 Every time I try to import my Spriter Project after importing the Spriter unity package I get a bunch of missing asset errors saying it can't find all the textures used. I don't know what I'm doing wrong. I followed what the instructions said. If you need anymore info let me know, sorry I'm fairly new to Unity. Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted December 25, 2015 Author Report Share Posted December 25, 2015 6 hours ago, hippyman said: Every time I try to import my Spriter Project after importing the Spriter unity package I get a bunch of missing asset errors saying it can't find all the textures used. I don't know what I'm doing wrong. I followed what the instructions said. If you need anymore info let me know, sorry I'm fairly new to Unity. Did you add all the images used in spriter to Unity? If yes, check if they were imported as Sprites - sometimes Unity imports them as Textures Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted December 30, 2015 Author Report Share Posted December 30, 2015 Released SpriterDotNet version 1.2.0. The new release includes several bug fixes, uses memory much more efficiently (after the initial setup, 0 heap allocations - even on the ancient Mono compiler used in Unity) and the ability to customise the frame data with IAnimationDataProviders. Entire Changelog Quote Link to comment Share on other sites More sharing options...
AndyGFX Posted December 30, 2015 Report Share Posted December 30, 2015 On 25. 12. 2015 at 0:35 AM, loodakrawa said: Did you add all the images used in spriter to Unity? If yes, check if they were imported as Sprites - sometimes Unity imports them as Textures Last time always In Spriter2UnityDX is changed TextureImporter to TextureImporterType.Sprite for prevent this issue. Is it possible add same feature to Unity SpriterDotNet? Best regards, Andy. Quote Link to comment Share on other sites More sharing options...
illidari Posted January 2, 2016 Report Share Posted January 2, 2016 I'm trying to add the RPG Heroes Pack to the program by referencing Male_128.scml private TSprite GetSwappedSprite(TSprite original) { if (swappedSprites.ContainsKey(original)) return swappedSprites[original]; return original; } An unhandled exception of type 'System.ArgumentNullException' occurred in mscorlib.dll Additional information: Value cannot be null. original is null A first chance exception of type 'Microsoft.Xna.Framework.Content.ContentLoadException' occurred in MonoGame.Framework.dll Missing Asset: RPG_pack_128/male/headgear_front_11 (wrong...should be /male/headgear/headgear_front_11) A first chance exception of type 'Microsoft.Xna.Framework.Content.ContentLoadException' occurred in MonoGame.Framework.dll Missing Asset: RPG_pack_128/male/helmet_side_11 A first chance exception of type 'Microsoft.Xna.Framework.Content.ContentLoadException' occurred in MonoGame.Framework.dll Missing Asset: RPG_pack_128/male/headgear_back_11 It looks like it is failing to handle a folder in a folder. Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted January 5, 2016 Author Report Share Posted January 5, 2016 On 30/12/2015 at 10:10 AM, AndyGFX said: Last time always In Spriter2UnityDX is changed TextureImporter to TextureImporterType.Sprite for prevent this issue. Is it possible add same feature to Unity SpriterDotNet? Best regards, Andy. I researched a bit and I don't feel comfortable with this library changing the import settings. You can achieve the same effect by changing the project from 3D to 2D. In 2D mode, all images should be imported as Sprites. As an alternative, you can use this script if you want to enforce a certain way of importing images. Cheers Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted January 5, 2016 Author Report Share Posted January 5, 2016 On 2/1/2016 at 2:15 PM, illidari said: I'm trying to add the RPG Heroes Pack to the program by referencing Male_128.scml private TSprite GetSwappedSprite(TSprite original) { if (swappedSprites.ContainsKey(original)) return swappedSprites[original]; return original; } An unhandled exception of type 'System.ArgumentNullException' occurred in mscorlib.dll Additional information: Value cannot be null. original is null A first chance exception of type 'Microsoft.Xna.Framework.Content.ContentLoadException' occurred in MonoGame.Framework.dll Missing Asset: RPG_pack_128/male/headgear_front_11 (wrong...should be /male/headgear/headgear_front_11) A first chance exception of type 'Microsoft.Xna.Framework.Content.ContentLoadException' occurred in MonoGame.Framework.dll Missing Asset: RPG_pack_128/male/helmet_side_11 A first chance exception of type 'Microsoft.Xna.Framework.Content.ContentLoadException' occurred in MonoGame.Framework.dll Missing Asset: RPG_pack_128/male/headgear_back_11 It looks like it is failing to handle a folder in a folder. SpriterGame.cs is just an example, not a complete solution. This might be caused by a variety of things (how you added the .scml and images to the project, how you registered them in the Content, etc) so I suggest debugging the LoadContent -> RegisterTextures -> FormatPath methods. This should give you a pretty clear idea about what's going on. Quote Link to comment Share on other sites More sharing options...
illidari Posted January 7, 2016 Report Share Posted January 7, 2016 On 1/5/2016 at 10:35 PM, loodakrawa said: SpriterGame.cs is just an example, not a complete solution. This might be caused by a variety of things (how you added the .scml and images to the project, how you registered them in the Content, etc) so I suggest debugging the LoadContent -> RegisterTextures -> FormatPath methods. This should give you a pretty clear idea about what's going on. Solved the problem. It seems this function covers all scenarios: private string FormatPath(SpriterFile file, string spriterName) { return String.Format("{0}/{1}", spriterName, file.Name); } If you trace the old code, you will see it stripping the folder names from the file name ...and then adding it back on with the folder variable...it works on the example because it changes "folder/file" down to "file" and concatenates "folder/" with "file" It broke my program because "folder/subfolder/file" is broken down into "file" and concatenates "folder/" with "file" If you just stick with the file name that already knows the folder, you don't need to do any of this or even send the folder variable into the function. <spriter_data scml_version="1.0" generator="BrashMonkey Spriter" generator_version="r5" pixel_mode="1"> <folder id="0" name="male"> <file id="0" name="male/head/head_front.png" width="68" height="72" pivot_x="0.5" pivot_y="0.5"/> <file id="1" name="male/hair_front/hair_base_0.png" width="128" height="116" pivot_x="0.5" pivot_y="0.5"/> <file id="2" name="male/torso/chest_front_0.png" width="52" height="64" pivot_x="0.5" pivot_y="0.5"/> <file id="3" name="male/torso/pelvis_front_0.png" width="52" height="28" pivot_x="0.5" pivot_y="0.5"/> <file id="4" name="male/left_leg/leg_front_0.png" width="32" height="40" pivot_x="0.5" pivot_y="0.5"/> <file id="5" name="male/left_leg/leg_front_1.png" width="32" height="40" pivot_x="0.5" pivot_y="0.5"/> Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted January 7, 2016 Author Report Share Posted January 7, 2016 20 hours ago, illidari said: Solved the problem. It seems this function covers all scenarios: private string FormatPath(SpriterFile file, string spriterName) { return String.Format("{0}/{1}", spriterName, file.Name); } If you trace the old code, you will see it stripping the folder names from the file name ...and then adding it back on with the folder variable...it works on the example because it changes "folder/file" down to "file" and concatenates "folder/" with "file" It broke my program because "folder/subfolder/file" is broken down into "file" and concatenates "folder/" with "file" If you just stick with the file name that already knows the folder, you don't need to do any of this or even send the folder variable into the function. <spriter_data scml_version="1.0" generator="BrashMonkey Spriter" generator_version="r5" pixel_mode="1"> <folder id="0" name="male"> <file id="0" name="male/head/head_front.png" width="68" height="72" pivot_x="0.5" pivot_y="0.5"/> <file id="1" name="male/hair_front/hair_base_0.png" width="128" height="116" pivot_x="0.5" pivot_y="0.5"/> <file id="2" name="male/torso/chest_front_0.png" width="52" height="64" pivot_x="0.5" pivot_y="0.5"/> <file id="3" name="male/torso/pelvis_front_0.png" width="52" height="28" pivot_x="0.5" pivot_y="0.5"/> <file id="4" name="male/left_leg/leg_front_0.png" width="32" height="40" pivot_x="0.5" pivot_y="0.5"/> <file id="5" name="male/left_leg/leg_front_1.png" width="32" height="40" pivot_x="0.5" pivot_y="0.5"/> You are absolutely right. I don't remember why I did it this way - probably just had a brain fart and didn't realise that the whole path is in the file name. I'll fix this with the next commit. Thanks! Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted January 10, 2016 Author Report Share Posted January 10, 2016 On 7/1/2016 at 1:30 PM, illidari said: Solved the problem. It seems this function covers all scenarios: private string FormatPath(SpriterFile file, string spriterName) { return String.Format("{0}/{1}", spriterName, file.Name); } I tried your solution and couldn't make it work. Then I remembered why I did it like that: Monogame content loading requires file name without extension. But if this works for you, I suppose you use a different version or have it configured in a different way. Which version do you use? Quote Link to comment Share on other sites More sharing options...
Dengar Posted January 11, 2016 Report Share Posted January 11, 2016 <moving this question to the unity specific version> Quote Link to comment Share on other sites More sharing options...
AndyGFX Posted January 12, 2016 Report Share Posted January 12, 2016 Hi, where can I find API doc? Currently I looking for a more informations how I can manage characterMap (activate/deactivate parts from map list) from script in runtime. Andy. Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted January 12, 2016 Author Report Share Posted January 12, 2016 2 hours ago, AndyGFX said: Hi, where can I find API doc? Currently I looking for a more informations how I can manage characterMap (activate/deactivate parts from map list) from script in runtime. Andy. Hi, The documentation is here and here (Unity Specific) There's a property on SpriterAnimator called CharacterMap which you can set to activate a certain character map. Take a look at the Unity example and/or Monogame example. Cheers Quote Link to comment Share on other sites More sharing options...
AndyGFX Posted January 12, 2016 Report Share Posted January 12, 2016 Hi, yes I tried included example for unity where is set next map from animator entity, but when I use for example 'no_weapon' on my animated character, then all sprites are invisible on character in scene. In Spriter editor when is changed available map to active, then is defined sprites are removed from actor in scene. Works this in code in same logic? Second problem is, how can I set multiple maps items on character similar as is set in Sprites editor, when I want hide armor and weapon (drag and drop to column Active). In doc missing information what is master map list and where is actual and how works map item fields. I tried debug array from animator entity, I see all defined maps in character maps list in entity instance, but animator.characterMap is null and when is set to map from entity characterMaps , then doesn't works. Maybe a few methods like SetMapActive(name) and SetMapInactive(name) would by nice to have and transparent from user point of view. Best regards, AndyGFX 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.