Unity Community


Page 53 of 126 FirstFirst ... 343515253545563103 ... LastLast
Results 1,041 to 1,060 of 2514

  1. Location
    Newcastle upon Tyne, UK
    Posts
    1,177
    I think 2D Toolkit could work for you, but I'll go through each of your points to tell you at least what to expect.

    2D Toolkit can't use TexturePacker spritesheets, so you'll need to import from individual sprites. Regularly spaced tiles work too. PNG transparencies should just work - you can test this by simply dragging your texture into unity, if the transparency appears correctly in there (it should), then 2D Toolkit will read and use it fine.

    I don't understand your question about colors/transparencies changing. The example you've shown is predominantly in black and white, so where do the colors / alpha come in? Our built in shaders allow you to tint instances of sprites so you can say make the hat 50% visible no problem at all without messing about with the atlas.

    Colliders can be generated automatically per sprite, and then should follow the animation, but the only type of collider which you can animate like this are boxcolliders to avoid creating and deleting components dynamically. In the current version you can't rotate box colliders relative to the sprite so that limits what you can do.

    The environment layering should just work, can't see any problems with that. You obviously understand that you'll need multiple layers for these textures / shadows / etc. Shouldn't be any problem. You simply position these at different z layers, and it'll just work fine. Its probably best to avoid perspective cameras, and favour the parallax script in our private support forum should you need that. It looks like you may not from the images though.

    One thing you didn't mention was what platform you're targetting. The number of layers you're describing there should be fine on PC, but I'd be very cautious trying anything like that on any mobile platform.

    Hope that helps, if you have any further questions, feel free to ask.


  2. Location
    Newcastle upon Tyne, UK
    Posts
    1,177
    Quote Originally Posted by sp00ks View Post
    How do you add in multiline text from code? If I have a string "First line\nSecond Line" and add it to the text mesh it doesn't seem to work
    Can you try this: In tk2dDemoAnimController, line 27 - change it to
    popupTextMesh.text = "First line\nSecond Line";
    and run the demo (5 - animation).

    I've tried this and it definitely works. I'm just trying to narrow down what could've gone wrong on yours.
    Last edited by unikron; 04-23-2012 at 11:03 AM.


  3. Location
    New Jersey
    Posts
    791
    Quote Originally Posted by unikron View Post
    Can you try this: In tk2dDemoAnimController, line 27 - change it to
    popupTextMesh.text = "First line\nSecond Line";
    and run the demo (5 - animation).

    I've tried this and it definitely works. I'm just trying to narrow down what could've gone wrong on yours.
    Depending on where you are pulling the "Firstline\nSecond Line" from in code you may need to use a different value than "\n". For example, I pull a lot of my string values from XML and they are auto-escaped. Instead if "First line\nSecond line" I use:

    "First Line Second Line" when pulling from XML.

    Sorry, the text editor is not agreeing with me.

    & # 10 ;
    ^^ remove the spaces and you've got yourself the XML New Line
    & # 13 ;
    ^^ remove the spaces and you've got yourself the XML Carriage Return

    If that doesn't help, mind showing us exactly how it's being used?


  4. Location
    Newcastle upon Tyne, UK
    Posts
    1,177
    Quote Originally Posted by meanstreak View Post
    I did get some messages in the console, but didn't copy them down. But now that you mention it, the "set up" button didn't appear in the cases where the font ended up being solid white. An easy test to reproduce on your end would be to make a font the old way, then delete the data and prefab files that get created with that process (since they get created again in the next step), and then try to add that same .fnt and .png to a sprite collection.
    Hi meanstreak,

    I've tried to reproduce the problem, but have been unable to so far. I tried this with a font generated from Glyph Designer, and I definitely don't get any errors at all. Please keep an eye out for if this happens again - I would very much appreciate if you could send me a broken test case if at all possible.

    Cheers,
    unikron


  5. Posts
    100
    Quote Originally Posted by unikron View Post
    I think 2D Toolkit could work for you, but I'll go through each of your points to tell you at least what to expect.

    2D Toolkit can't use TexturePacker spritesheets, so you'll need to import from individual sprites. Regularly spaced tiles work too. PNG transparencies should just work - you can test this by simply dragging your texture into unity, if the transparency appears correctly in there (it should), then 2D Toolkit will read and use it fine.

    I don't understand your question about colors/transparencies changing. The example you've shown is predominantly in black and white, so where do the colors / alpha come in? Our built in shaders allow you to tint instances of sprites so you can say make the hat 50% visible no problem at all without messing about with the atlas.

    Colliders can be generated automatically per sprite, and then should follow the animation, but the only type of collider which you can animate like this are boxcolliders to avoid creating and deleting components dynamically. In the current version you can't rotate box colliders relative to the sprite so that limits what you can do.

    The environment layering should just work, can't see any problems with that. You obviously understand that you'll need multiple layers for these textures / shadows / etc. Shouldn't be any problem. You simply position these at different z layers, and it'll just work fine. Its probably best to avoid perspective cameras, and favour the parallax script in our private support forum should you need that. It looks like you may not from the images though.

    One thing you didn't mention was what platform you're targetting. The number of layers you're describing there should be fine on PC, but I'd be very cautious trying anything like that on any mobile platform.

    Hope that helps, if you have any further questions, feel free to ask.
    Thanks, following
    Targeting PC Win, but ill want to translate to mobile devices as part of my learning path
    It will be orthographic top down camera only, no parallax.

    The ability to work with sprite sheets would really help my workflow, have to see if i can work around it.
    anyway leaving my suggestion to look in to it http://www.texturepacker.com/texturepackertutorials/
    http://www.rocket5studios.com/tutori...-tools-part-2/

    Colliders
    rectangular only i can live with.
    If i want a collider to follow my sword swing movement I must set it manually per sprite, correct?
    On the example below using the automatic generation: sprite1 would translate to sprite 2 and when rotated to sprite 3 or 4?



    Will leave crash testing stacking layers on mobile for later.

    Thanks for your time


  6. Location
    Newcastle upon Tyne, UK
    Posts
    1,177
    Quote Originally Posted by Uttpd View Post
    Thanks, following
    Targeting PC Win, but ill want to translate to mobile devices as part of my learning path
    It will be orthographic top down camera only, no parallax.

    The ability to work with sprite sheets would really help my workflow, have to see if i can work around it.
    anyway leaving my suggestion to look in to it http://www.texturepacker.com/texturepackertutorials/
    http://www.rocket5studios.com/tutori...-tools-part-2/

    Colliders
    rectangular only i can live with.
    If i want a collider to follow my sword swing movement I must set it manually per sprite, correct?
    On the example below using the automatic generation: sprite1 would translate to sprite 2 and when rotated to sprite 3 or 4?



    Will leave crash testing stacking layers on mobile for later.

    Thanks for your time
    So are these sprites rotated in 3D or do you have sprites for all the different angles you want to rotate to? If its just rotated in Unity, the box would just work as expected (#3). If you have custom rotated sprites, what you'd get now is not exactly #4, but an axis aligned bounding box covering the entire sword.

    In most cases, simply setting it to automatically generate trimmed box colliders will do the job for these. Its only when you want to get more specific where it becomes a problem.


  7. Posts
    164
    @unikron is it possible to change anchor point of a sprite in runtime from the script?


  8. Location
    Newcastle upon Tyne, UK
    Posts
    1,177
    No it isn't and that is intentional. If you need to change anchor points at runtime, I suggest simply attaching a GameObject as a child of the sprite at the correct point and moving that, or if you need to change the origin of the sprite itself, making the sprite a child of the gameobject.

    The reason for this is that sprites can be diced (i.e. are constructed of lots of tiny bits, and as of version 1.70, you will be able to draw custom sprite shapes too, not restricted to rectangles) - there won't be enough information at runtime to do this for all the supported use-cases, and due to the number of triangles, could be quite expensive too.

    Out of curiosity, what were you planning on doing by moving anchor points dynamically?


  9. Posts
    164
    Quote Originally Posted by unikron View Post
    No it isn't and that is intentional. If you need to change anchor points at runtime, I suggest simply attaching a GameObject as a child of the sprite at the correct point and moving that, or if you need to change the origin of the sprite itself, making the sprite a child of the gameobject.

    The reason for this is that sprites can be diced (i.e. are constructed of lots of tiny bits, and as of version 1.70, you will be able to draw custom sprite shapes too, not restricted to rectangles) - there won't be enough information at runtime to do this for all the supported use-cases, and due to the number of triangles, could be quite expensive too.

    Out of curiosity, what were you planning on doing by moving anchor points dynamically?
    Thanks!, I suppose to use an additional GameObject . I have to duplicate the same sprite a lot of times but each sprite should be rotate dynamically with their own anchor point (think in long rectangles like hands of a watch).


  10. Location
    Newcastle upon Tyne, UK
    Posts
    1,177
    Quote Originally Posted by spartan View Post
    Thanks!, I suppose to use an additional GameObject . I have to duplicate the same sprite a lot of times but each sprite should be rotate dynamically with their own anchor point (think in long rectangles like hands of a watch).
    I should also mention that you can add a sprite multiple times to a sprite collection (and have different settings on each) - the texture gets put in the atlas only once. May not suit your intentions, but just a FYI.


  11. Posts
    4
    Hello! I have animation and trigger on one of it frame. I attach a function to animationEventDelegate, but sometimes it doesnt launch. Why does it happen?
    Code:  
    1. public void PlayAnimation(string animationName){
    2.     animatedSprite.animationEventDelegate = CreateProjectileEvent;
    3.     animatedSprite.Play(animationName);
    4. }
    5. void CreateProjectileEvent(tk2dAnimatedSprite sprite, tk2dSpriteAnimationClip clip, tk2dSpriteAnimationFrame frame, int frameNum){
    6.        
    7.         Projectile projectile = (Instantiate(projectileObject, transform.position, Quaternion.identity) as GameObject).GetComponent<Projectile>();
    8.        
    9. }
    Sometimes game object instantiates, but sometimes doesn't.


  12. Location
    Newcastle upon Tyne, UK
    Posts
    1,177
    This is a tricky one and I think I'm going to have to think of a proper way to solve it. So basically, the event delegate only gets triggered when the particular frame is displayed, but if the game is running slightly slowly, and the frame doesn't display or gets skipped, it never triggers.

    The obvious solution is to walk the frames to see if anything should have been triggered, but this introduces more problems -

    - process the update in FixedUpdate, which could still miss frames at additional cost.

    - what happens when the framerate is so fast that the animation has cycled 10x in one visual frame? Easy solution, minimum fps of animation = fps of game, but the fps of the game could be 30 / 60 or even dynamic.

    - ideally, the delegate target should know when in time the animation event occurred too, so if in one frame you get 4 events (i.e. 4 frames have passed, and we'ere currently displaying the 5th), could happen even when the constraint above is enforced when frame rate drops, for instance, the target should be told when that would have occured, i.e. X secs in the past or something like that.

    if any of these would work for you let me know, or if you have any other suggestions, I'll be happy to hear em!


  13. Posts
    100
    update, got it.
    Regarding the sprite sheet importing from Texture Packer, got it working after reading on the docs:

    "Sprite Sheet Import introduced support for automatically splitting regularly spaced sprite-sheets. 2D Toolkit will split these up and atlas them like any other texture. These textures do NOT have to be power of two, but the dimension MUST divide perfectly with the number of divisions. To set these up, simply add entries to the SpriteSheets section of the Sprite Collection set up."

    since Texture packer can build a sheet without trimming or cropping, I got it working, have to further text if everything is running with precision. But hopefully you can had to the features a sprite-sheet import ready from Texture Packer.


  14. Location
    Newcastle upon Tyne, UK
    Posts
    1,177
    That document is slightly out of date - the textures dimension doesn't need to be perfectly divisible by number of divisions - indeed you now enter exact tile sizes in now and you can also set up offsets, etc.

    I have added native TexturePacker import to the backlog, but the priority is low - it'll be quite a while before I get around to doing it. I can reprioritize if there is more interest though, so anyone else who would like this feature, please let me know.


  15. Posts
    1
    Hello
    Excuse me, I want to adjust the button inside my project, I found that the size of the button seems to only be adjusted from the Sprite Scale, is not the same as UnityGUI a Button can be directly set the width with the height practice.

    I Camera related settings are as follows
    Projection = Orthographic
    Size = 480


  16. Posts
    100
    Quote Originally Posted by unikron View Post
    That document is slightly out of date - the textures dimension doesn't need to be perfectly divisible by number of divisions - indeed you now enter exact tile sizes in now and you can also set up offsets, etc.

    I have added native TexturePacker import to the backlog, but the priority is low - it'll be quite a while before I get around to doing it. I can reprioritize if there is more interest though, so anyone else who would like this feature, please let me know.
    It would be nice but no real priority as it works with the present build.
    As long all your individual sprites are the same size, 2Dtoolkit can extract and build an atlas from the TexturePacker spreadsheet.

    Workflow:
    on Texture Packer: just unchek "trim" "rotation", and set "Border" and "Shape"padding to 0, publish for "cocos2d" default ".png" -- you should get a clean spreadsheet with all the images align,

    2DToolkit will cut it perfectly, and rename them as original-name/0x0, /0x1 etc following the position on the spreadsheet

    The autofill function did not work do. Is there any naming convention I should follow?


  17. Location
    Newcastle upon Tyne, UK
    Posts
    1,177
    The 1.70 versions now name the imported textures as name/0..N-1, and will be compatible with the autofill feature. That was an oversight on my part


  18. Posts
    7

    2d Toolkit button

    Hello again.

    I've been experiencing this many times already.

    I'm using the button scripts that came with the toolkit.

    It is working good so far. Though there is a strange problem. Sometimes, the button refuse to get clicked (where it was clickable before). And this issues doesn't happen at run time, it becomes permanent.

    To fix this, I actually have to remove the component, and re add it again. I tried resetting, but it didn't work. This happened to me at least 3 times already.


  19. Location
    Newcastle upon Tyne, UK
    Posts
    1,177
    Thats really strange, whatever state should reset when the game gets restarted. Would it be possible to send a repro case when this is broken to the support email add (support at unikronsoftware dot com)


  20. Location
    Newcastle upon Tyne, UK
    Posts
    1,177
    1.7 beta 3 has been released on the forum.
    http://unikronsoftware.com/2dtoolkit...1.msg1000.html

    Tons of bugfixes and features.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •