Unity Community


Page 5 of 108 FirstFirst ... 345671555105 ... LastLast
Results 81 to 100 of 2156

  1. Posts
    6,317
    @Acumen, give it a try and see if it works. I believe (but don't quote me on this) that Unity does squarify non-square textures (definitely so for PVR as they only support square). If the image is squarified all your UV's will be wrecked and you will know right away.


  2. Location
    Chicago, IL
    Posts
    742
    Quote Originally Posted by Prime31 View Post
    Just for you mehware I pushed a new build with support for web and standalone.
    Thanks prime you rock!

    - Matt
    Shooter's Alley iOS - Thread


  3. Posts
    6,317
    For anyone interested, the PanelBasedRoot branch on Github was just updated and will most definitely become the mainline branch real soon. It has support for grouping elements into a parent (for easy animations of multiple items) and most importantly it supports an unlimited number of texture atlases. The API will remain identical for a single texture atlas but there are a few changes to it when using multiple (each sprite needs to know where its mama is). There is a demo scene included showing 2 atlases in one scene.

  4. Super Moderator
    Location
    Great Britain
    Posts
    9,680
    Quote Originally Posted by Prime31 View Post
    @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!
    Good lord o larkie, its working! Thanks Prime!



    ITS ALIVE
    Currently working with Sony on our new
    PS4 and Vita game in Unity!

    This post is not representative of Simian Squared Ltd


  5. Posts
    6,317
    Awesome! Once you do it once it's simple every time thereafter. And regenerating with new sprites is quick also.


  6. Posts
    994
    Did i understand this correctly that you managed to put the font on the same atlas as the other game relevant gui items ? That'd be great
    We could fit all the highscore and timer fonts on one atlas

    Can you confirm this, hippocoder ?
    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


  7. Posts
    6,317
    You can put your font and all the rest of your UI on one atlas. That is correct.


  8. Location
    Valencia - Spain
    Posts
    289
    Quote Originally Posted by Acumen View Post
    Did i understand this correctly that you managed to put the font on the same atlas as the other game relevant gui items ? That'd be great
    We could fit all the highscore and timer fonts on one atlas

    Can you confirm this, hippocoder ?
    That's the purpose of this library, group all your GUI images including the font in only 1 atlas and draw everything with just one draw call, saving you drawing calls for other important things
    Last edited by Eskema; 05-07-2011 at 02:37 PM.
    http://eskemagames.blogspot.com iOS/Android game developer

  9. Super Moderator
    Location
    Great Britain
    Posts
    9,680
    It's great stuff. In my own iphone game I actually just used LoadImage(filename, optionalAtlas=null);
    then Pack();

    And it would basically load images and pack them all onto an atlas in realtime but we can't do that in unity without making this library pro only. It is a much more funky choice if you are interested in super small distributables since you don't duplicate anything. But these days with Infinity Blade on appstore taking up a gig, who's counting?
    Currently working with Sony on our new
    PS4 and Vita game in Unity!

    This post is not representative of Simian Squared Ltd


  10. Location
    Valencia - Spain
    Posts
    289
    The important here for me it's not the space but the performance. Having all your GUI and font images in one single atlas and draw all of them with a single draw call should be a standard for any engine out there
    http://eskemagames.blogspot.com iOS/Android game developer

  11. Super Moderator
    Location
    Great Britain
    Posts
    9,680
    Having trouble getting a font up and running on the screen in javascript. I have got this far so far:

    private var text1:UITextInstance;

    Code:  
    1. function Start()
    2. {
    3.     //load the font
    4.     var text = new UIText( "myfont", "myfont.png" );
    5.  
    6.     // spawn new text instances showing off the relative positioning features by placing one text instance in each corner
    7.     var x:float = UIRelative.xPercentFrom( UIxAnchor.Left, 0, 0);
    8.     var y:float = UIRelative.yPercentFrom( UIyAnchor.Top, 0, 0 );
    9.     text1 = text.addTextInstance( "hello man.  I have a line\nbreak", x, y );

    xPercentFrom needed two parameters in javascript, I dont know why. I gave it an extra 0 and the error went away.

    But text1 = text.add throws an error (Assets/scripts/Game.js(17,37): BCE0023: No appropriate version of 'UIText.addTextInstance' for the argument list '(String, float, float)' was found.)...

    is this library c# only?
    Currently working with Sony on our new
    PS4 and Vita game in Unity!

    This post is not representative of Simian Squared Ltd

  12. Super Moderator
    Location
    Great Britain
    Posts
    9,680
    Ah I see! js does not allow optional parameters
    Currently working with Sony on our new
    PS4 and Vita game in Unity!

    This post is not representative of Simian Squared Ltd


  13. Posts
    6,317
    @hippocoder, the next push will have all the optional params removed temporarily until MonoDevelops bug is fixed.

    I guess now is a good time for me to push my hidden agenda: NEVER USE JAVASCRIPT! C# has more features, millions more resources to learn, MUCH better editor integration (full code complete, refactoring and tons of other code generation tools) and many other goodies. On top of that, learning C# is a skill that you can actually put on a resume.


  14. Location
    Cambridge UK
    Posts
    141
    Yet another excellent tool from you prime.

    Regarding positioning of gui elements, is there an easy way to center an object on the screen, horizontally, vertically, or both? I couldn't see an easy way to do this, but perhaps i'm blind.


  15. Posts
    6,317
    @Matkins, there is a positionCenter method along with the other relative positioning methods. They are all in a class of extension methods for easy perusing. The same goes for the animation methods. The filename will give it away because it will end with "Extensions" to indicate that it is extension methods.


  16. Location
    Virginia, USA
    Posts
    436
    Dangit, you're going to force me to learn/use C#
    Follow me @defjr


  17. Posts
    6,317
    @Earl, no forcing. Just a firm suggestion. It will make your life easier in the long run

  18. Super Moderator
    Location
    Great Britain
    Posts
    9,680
    Prime: I started with C++ and really fell in love with just a simple life of js :P I will probably get nagged by mike_mac or Neil Carter on IRC to go C# at some point. But I think optional parameters lead to messy code anyway
    Currently working with Sony on our new
    PS4 and Vita game in Unity!

    This post is not representative of Simian Squared Ltd


  19. Posts
    6,317
    @hippo, the thing is I fail to see how JS is simpler. It lacks features available to C#, doesn't have anywhere near functioning code complete and it doesn't exist outside of the Unity world. That alone is reason enough to go C# let alone the myriad other reasons.

  20. Super Moderator
    Location
    Great Britain
    Posts
    9,680
    I'm old and stubborn. When you get to my age, young prime, you'll see. Hee hee. Having said that I'll port to c later tonight I guess.

    Question: how do get the actual on-screen width of a string displayed? The reason for this is because I want to generate buttons under the text, which can be tapped

    I'd rather prioritise text size than button size for this particular way of working as it will be several lines of text which need to be a set size. Do you have methods exposed to return the rendered bounds of a particular piece of rendered text.
    Currently working with Sony on our new
    PS4 and Vita game in Unity!

    This post is not representative of Simian Squared Ltd

Page 5 of 108 FirstFirst ... 345671555105 ... 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
  •