Author Topic: UISprite script disabled but the sprite is still visible ???  (Read 3304 times)

missingno

  • Guest
UISprite script disabled but the sprite is still visible ???
« on: September 17, 2013, 08:51:14 AM »
I have a weapon UI that shows and hides depending on what weapons the player has unlocked.

When I am playing a game with weapons unlocked and then go back to my main menu and start a new game all my players data is reset correctly and they are back to only the default weapon, I also disable all the sprites in my weapon slots for the weapons that used to be enabled the previous game. However the background sprites are still visible for the previously unlocked weapons even though their UISprite script is disabled, if I enable the script manually it refreshes and hides as it should.

Why is the sprite still visible when the UISprite (i've also tried just disabling the parent gameobject to hide the slot but the same thing happens, the background is still visible while the rest of the sprites are not, theres also the weapon icon, ammo, etc.) ???

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UISprite script disabled but the sprite is still visible ???
« Reply #1 on: September 17, 2013, 02:45:44 PM »
If you disable the UISprite, whatever it's drawing goes away. What version of NGUI are you using?

missingno

  • Guest
Re: UISprite script disabled but the sprite is still visible ???
« Reply #2 on: September 18, 2013, 08:38:01 AM »
Currently 2.6.4 as I am unable to get 2.7.0 due to my other post.

Edit: It appears to be an issue with disabling the panel at the wrong time, I added OnEnable/OnDisable methods to my weapons slots that hides the sprites and it works as intended (albeit with an addition method put in).

It's almost like the script gets disabled, but then the panel gets disabled before the sprite can be removed from it so it gets stuck in the panels draw call, does that make any sense ?
« Last Edit: September 18, 2013, 09:12:41 AM by missingno »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UISprite script disabled but the sprite is still visible ???
« Reply #3 on: September 18, 2013, 01:44:10 PM »
Yes, I've heard of that rare issue in the past...