Unity Community


Page 4 of 108 FirstFirst ... 234561454104 ... LastLast
Results 61 to 80 of 2156
  1. Super Moderator
    Location
    Great Britain
    Posts
    9,656
    Oh brilliant stuff that makes sense, I had been dithering with the idea of packing font and joystick images / misc ui stuff for the actual game screen in one tight file and this makes it so much easier. I will have a play with what you suggested thanks
    Currently working with Sony on our new
    PS4 and Vita game in Unity!

    This post is not representative of Simian Squared Ltd

  2. Super Moderator
    Location
    Great Britain
    Posts
    9,656
    I followed the video tutorial exactly including setting my png font texture as text but no joy just yet. I did use an atlas from texturepacker (called font.txt) and put that name without the .txt into my UI script. I also have it's material set as UIToolkitMaterial.

    I am just trying to get it to compile and run without any code at the moment but it crashes on run each time. I'm sure I'm stupid, and I must be missing something. I've triple checked everything and it throws exceptions about texture width. The texture is in a folder called Font, would that be a problem, is it looking for a folder called Resources?

    Double-checked everything. Time to go to bed and dream of Prime31 letters and pink hippos.
    Last edited by hippocoder; 05-06-2011 at 10:43 PM.
    Currently working with Sony on our new
    PS4 and Vita game in Unity!

    This post is not representative of Simian Squared Ltd


  3. Posts
    6,314
    You almost got it. All the files (your exported fnt file, the exported json file and the exported png atlas) all need to be in a folder called Resources. Just in case it isn't clear, the fnt file and the json file both need to have their file extension replaced with .txt so they can be loaded into a TextAsset.


  4. Location
    Valencia - Spain
    Posts
    289
    For all the people who prefer to not mess with names I've made a little fix to avoid the renaming of the .fnt file and the .json file.
    What this means? you only need to create a folder called "StreamingAssets" in the root of your unity project (within the editor) and simply place the ".fnt" file and the ".json" file there. There's no need anymore to rename it to .txt
    Of course the texture should remain in the "Resources" folder as usual

    Attached Files
    http://eskemagames.blogspot.com iOS/Android game developer


  5. Posts
    994
    Just watched the video tutorials - boy this looks good

    1) I was wondering, what about the actual menu background graphics.
    Can these be implemented and animated with the help of this toolset, too ? Or is this another kind of task it was not designed for yet ?

    I'm reeeeally curious about the font video
    This is something that has constantly bugged me and I never quite got my head around things, yet I feel we're thhhhhhis close to getting a breakthrough !

    Thank you so much for this wonderful piece of toolkit that it is
    2D Infinite Runner Toolkit - feature complete and easy to use package
    2D Physics Puzzle Kit - Incredible Machine gameplay within Unity

    My portfolio: www.acumen-design.de/blog - Contact: fabi@acumen-design.de

    Once killed a thread by posting in it in size 1


  6. Posts
    6,314
    @Eskema, I purposely removed SreamingAssets due to Android not supporting it. There is no way to get at files in StreamingAssets without a plugin on Android believe it or not.

    @Acumen, backgrounds will work fine though they will eat a huge amount of your texture atlas so sticking then on a quad might be a good idea unless you have ro in your atlas of course.


  7. Posts
    994
    Yeh that would be perfect method for the example I'm thinking of anyways.
    Also I was wondering. What we did for our current gui to save texture space is to make the graphics "overlapping" so we could reuse the underlaying buttons and render the font/symbols on top and squeeze most of the texture space.
    Is this what were talking about in the video ? Just some 2-3 variable changes and that would work like a charme, too ?
    2D Infinite Runner Toolkit - feature complete and easy to use package
    2D Physics Puzzle Kit - Incredible Machine gameplay within Unity

    My portfolio: www.acumen-design.de/blog - Contact: fabi@acumen-design.de

    Once killed a thread by posting in it in size 1


  8. Posts
    6,314
    @Acumen, you get zIndex support so you could definitely do that.


  9. Location
    Valencia - Spain
    Posts
    289
    I know that android doesn't support (at least for now) that folder, but as I'm only working with IOS it's not a problem for me and I prefer to continue using the streamingassets folder
    Probably there are other people in my situation using only unity for IOS and it's much easier to not rename things
    http://eskemagames.blogspot.com iOS/Android game developer

  10. Super Moderator
    Location
    Great Britain
    Posts
    9,656
    Still not working.

    1. go to hiero, make a font, export as font
    2. rename the exported .fnt file to txt and optionally vertically flip the png.I now have font.png and ariel.txt
    3. open texturepacker. drag the font in and export as .json. Rename the .json as font.txt
    4. I have 3 files: font.txt (json), font.png, and ariel.txt in Assets/Resources/
    5. open unity. set the png to be of type GUI.
    6. Add a layer called UILayer.
    7. add a gameobject called UILayer with a script on it called UI.
    8. Set the texture packer name as "font" without quotes or extension.
    9. Set the layer to UILayer, and ensure UILayer mask isn't on my main camera.
    10. optionally set a decent material which will have no texture, for shader purposes.

    Hit run to test its all ok and get:

    "NullReferenceException
    UnityEngine.Texture.get_width () (at C:/BuildAgent/work/6bc5f79e0a4296d6/Runtime/ExportGenerated/Editor/Graphics.cs:900)
    UISpriteManager.Awake () (at Assets/Plugins/UIToolkit/BaseElements/UISpriteManager.cs:116)
    UI.Awake () (at Assets/Plugins/UIToolkit/UI.cs:37)"

    I did this on a fresh scene to be sure.

    Any ideas?
    Last edited by hippocoder; 05-07-2011 at 09:26 AM.
    Currently working with Sony on our new
    PS4 and Vita game in Unity!

    This post is not representative of Simian Squared Ltd


  11. Location
    Valencia - Spain
    Posts
    289
    The font name .fnt and the texture MUST be the same name, so you should have bitmapfont.fnt and bitmapfont.png
    http://eskemagames.blogspot.com iOS/Android game developer


  12. Posts
    6,314
    @Eskema, I like the StreamingAssets method much better too. Damn Android always has to be a pain...

    @hippo, sounds like you are still missing the JSON config file from TexturePacker. Stick font.png into a TexturePacker atlas then export. You will get a png atlas and a JSON config file that need to have the same name. This name needs to be input in the UI class' inspector so that it can get the texture coordinates. Checkout the text demo scene to see a working example.


  13. Location
    Valencia - Spain
    Posts
    289
    Your solution is better because you have a global product so the only way is to use a global solution for all devices, in my case I don't care about android and I can proceed with a more crappier solution
    http://eskemagames.blogspot.com iOS/Android game developer

  14. Super Moderator
    Location
    Great Britain
    Posts
    9,656
    The .png file and json -are- the same name :S

    font.png
    font.txt (the json)
    ariel.txt (the .fnt file)

    The font name .fnt and the texture MUST be the same name
    You will get a png atlas and a JSON config file that need to have the same name.
    You are both saying different things... because I have to rename to .txt, the .fnt file was renamed to ariel.txt, as mike does in his own project. Still does not work. I still can only use .txt extensions, right?

    I tried this naming scheme:

    font.png
    font.txt (from hiero)
    fontjson.txt (from packer)

    and also tried the alternative:

    font.png
    fonthiero.txt (from hiero)
    font.txt (from packer)

    All in Resources folder.

    Obviously updating Texture Packer Config Name to always point at the packer file without an extension. Can't get it to work. I think I'm cursed.
    Last edited by hippocoder; 05-07-2011 at 10:47 AM.
    Currently working with Sony on our new
    PS4 and Vita game in Unity!

    This post is not representative of Simian Squared Ltd

  15. Super Moderator
    Location
    Great Britain
    Posts
    9,656
    {"frames": {

    "font.png":
    {
    "frame": {"x":0,"y":0,"w":256,"h":202},
    "rotated": false,
    "trimmed": true,
    "spriteSourceSize": {"x":0,"y":0,"w":256,"h":202},
    "sourceSize": {"w":256,"h":256}
    }
    },
    "meta": {
    "app": "http://www.texturepacker.com",
    "version": "1.0",
    "image": "font.png",
    "format": "RGBA8888",
    "size": {"w":256,"h":256}
    }
    }
    contents of my exported json.
    Currently working with Sony on our new
    PS4 and Vita game in Unity!

    This post is not representative of Simian Squared Ltd


  16. Posts
    6,314
    @hippo, here are the exact steps to follow:

    - create and export font bitmap and config file from Hiero
    - rename the .fnt file to "myfont.txt" and rename the .png file to "myfont.png"
    - create a new Texture Packer document and drag the exported png file from Hiero into it
    - set the data file name in Texture Packer to "myatlas"
    - export from Texture Packer then rename the exported myatlas.json file to "myatlas.txt"
    - drag the myfont.txt, myatlas.txt and myatlas.png files to a Resources folder
    - set the texturePackerConfigName in the inspector to myatlas
    - create a UIFont with: var text = new UIText( "myfont", "myfont.png" );

    Bamm! Success!


  17. Posts
    994
    Got another question.
    Actual menu animation, e.g. meaning that everything slides out/in can that be done with the plugin too ?
    For example, you click a button and the entire thing slides out to the left side and another menu slides in from the right side, with all buttons set up.
    Like some easy way to link all buttons to a background plane or something, that makes up an entire menu scene ?
    Can the toolkit be used for such actions, too, or would these have to be linked together and animated externally ?
    2D Infinite Runner Toolkit - feature complete and easy to use package
    2D Physics Puzzle Kit - Incredible Machine gameplay within Unity

    My portfolio: www.acumen-design.de/blog - Contact: fabi@acumen-design.de

    Once killed a thread by posting in it in size 1


  18. Posts
    6,314
    @Acumen, there is a branch on Github with support for grouping items and animating them. It also has support for multiple atlases in a single scene (almost). That branch will become the mainline as soon as all the bugs are worked out.


  19. Posts
    994
    Splendid !
    Needless to say we just threw away everything we had so far and are moving over to your toolkit

    Next Question:
    What I'm wondering is, say we're tackling the main menu and the gfx just doesn't need a full 512x512 but a 256x512 instead. Will this have any drawbacks ? I mean it's power of 2, but anywhere you turn to it is advised to stay away from nonsquare textures.

    Should I rather add some other menu items from one of the next screens on top of these ?
    Last edited by Acumen; 05-07-2011 at 11:46 AM.
    2D Infinite Runner Toolkit - feature complete and easy to use package
    2D Physics Puzzle Kit - Incredible Machine gameplay within Unity

    My portfolio: www.acumen-design.de/blog - Contact: fabi@acumen-design.de

    Once killed a thread by posting in it in size 1


  20. Location
    United Kingdom
    Posts
    87
    Mike,

    Thanks for sorting out the android issues so quickly, I'll be grabbing the branch tonight to have a play with the panels too. Expect emails !!!



    All the best...

Page 4 of 108 FirstFirst ... 234561454104 ... LastLast

Posting Permissions

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