Author Topic: What's the best way to support different UIFont symbols for PS4/XB1/etc buttons?  (Read 9167 times)

Paul

  • Newbie
  • *
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 22
    • View Profile
We're in the process of porting to PS4 and XboxOne and our game makes use of UIFont symbols for things like controller button icons, ie: "Press the <A> button to continue" where "<A>" is a sprite for the 'A' button on the controller. The PS4 controller uses a separate set of icons (shapes instead of A,B,X,Y for example).

We're trying to keep all platforms on the same repo, so my question is:

What's the best way to support different icons for the "<A>" symbol based on the given platform?

If there's an existing API in NGUI that would be a great place to start, otherwise we'll likely implement a custom solution for this.

Thanks in advance.

Paul

  • Newbie
  • *
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 22
    • View Profile
EDIT: (I did not see an edit button) This also applies to UIAtlas, as we've got some platform specific controller icons in our atlas, so if there's a way to swap those out based on #if PS4/XB1 defines that would be a huge help.

Paul

  • Newbie
  • *
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 22
    • View Profile
EDIT2: I found some success with UIFont.RenameSymbol(), but we decided it's actually going to be easier to just swap out the png glyphs for the fonts and regenerate the atlas for each platform. It's a little less flexible but a lot less work and should do well enough.

Sorry for the inconvenience!

Paul

  • Newbie
  • *
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 22
    • View Profile
EDIT3: Actually, is there a way to regenerate an atlas which includes _ALL_ the sprites? After replacing the button icons manually via Windows Explorer, it seems I have to manually select each sprite from the atlas and hit "Update" for it to pick up the change.

Is there an "Update All" equivalent somewhere for the atlas?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
I'd still suggest using RenameSymbol(). When your game starts up, in an Awake() of a custom script just change symbols based on the platform. Start with specific ones, such as "<XBA>" and "<PSA>" and rename one set to just "<A>". This way you will only have one atlas.