Author Topic: Slight problem with Inventory example scripts  (Read 2388 times)

efgames

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Slight problem with Inventory example scripts
« on: June 25, 2014, 09:04:40 AM »
I'm using the Equipment's scripts for a new project and while I got everything to work, there is a weird behavior when I select an item that is been slotted to my character.

All items are properly populating my various slots, at the correct scale, but when I click on an item to select it and move it to the backpack, the item scales up.
I'm using NGUI sprites for the items (compared to the 3d model used in the example).

While displayed in the character's slot, if I take my shoulder item for example, the size of the sprite displayed is 38x38. The actual sprite dimensions are 67x65 but it's scaled down to fit my box.
However, as soon as I click it and it "attaches" to the cursor, it scales up the cursor and scales up to 68x68.

I'm using FixedSizeon Mobile for both the camera in charge of the Tooltip/Cursor and the camera that displays the character's sheet itself.

I assume the script that scales up the sprite is the UICursor script, but I'm not too sure which section does the scaling. For example, when I tried to comment out the instance.mSprite.MakePixelPerfect(); the icon scaled up as well (slightly less, 60x60), but when I did drop it on the backpack, it scaled up to 68x68.

Any idea what I should be modifying?

I'd like to understand what part does the scaling so I could either scale them down if needed, or keep them at the size my backpack slots will be.

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Slight problem with Inventory example scripts
« Reply #1 on: June 26, 2014, 09:27:03 AM »
MakePixelPerfect() is what resets the sprite's scale, yes. The UICursor switches its sprite with that of the chosen one (the item you clicked on). UIItemSlot does the same thing on line 187 of UIItemSlot.cs.