Author Topic: Character X Example - Backback and UICursor icon sizes  (Read 2390 times)

Rajmahal

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Character X Example - Backback and UICursor icon sizes
« on: February 10, 2014, 12:47:29 PM »
Hi,

I'm using the Character X example in my game's inventory UI and I've run into an issue.  Regardless of what I do, when I drag an inventory item onto a slot in the backpack UIItemStorage grid, the icon is always drawn at 120x120, which is bigger than the UIItemStorage grid size of 79x79.  Similarly, when dragging the item, the UICursor that shows the item as it is dragging is also created at dimensions 120x120. 

I see that the backpack UIItemStorage grid uses a prefab (Storage Icon Template) to draw the icon when there is an item in a slot.  I have tried adjusting the dimensions of that prefab's Icon object to 79x79 but at runtime, the icon is always drawn at 120x120.  Similarly, I have tried adjusting the UICursor's sprite object to 79x79 but it is also drawing at 120x120.

I've tried to search in the code for where the dimensions of these icons is assigned since it doesn't grab them from the prefabs but I'm not able to find it.  Can anyone help?

Rajmahal

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: Character X Example - Backback and UICursor icon sizes
« Reply #1 on: February 10, 2014, 12:51:20 PM »
Also, I have reproduced this in the original Character X example and confirmed that it also always draws the inventory item icon at a fixed size, regardless of the dimensions of the Icon attached to the Storage Icon Template prefab.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Character X Example - Backback and UICursor icon sizes
« Reply #2 on: February 10, 2014, 05:30:25 PM »
The backpack items are spawned from a prefab, which has certain size widgets on it. Did you ever adjust the size on that prefab's widgets?

Rajmahal

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: Character X Example - Backback and UICursor icon sizes
« Reply #3 on: February 10, 2014, 05:46:16 PM »
Yes, I did ... I found that doing so didn't affect the size of the objects spawned at runtime.

I found a fix but it involved essentially hard coding the size of the UICursor and backback icon sizes.  I'm okay with that as it's fine for my game it might be something you want to look at if it is a bug.

Trance_Trap

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 1
  • Posts: 5
    • View Profile
Re: Character X Example - Backback and UICursor icon sizes
« Reply #4 on: March 20, 2014, 09:12:48 PM »
can you provide the code you used ?
One Person can make a difference, and Every Person should Try. ~John F. Kennedy

My avatars' text: "You wouldn't like me when I'm angry... Because I Always backup my rage w/Facts & documented sources" ~The Credible Hulk(he's wearing glasses) ... Lol I just thought it was hilarious ^_^