Hello Guest

Author Topic: Wierd Disappearing Sprite issue.  (Read 5603 times)

CoderBear

  • Newbie
  • *
  • Posts: 13
    • View Profile
Wierd Disappearing Sprite issue.
« on: April 28, 2013, 12:46:05 am »
OK I have this really weird issue going on when running on Android Devices (any of them).  There 4 buttons using the button UI.  The pause button when pressed for some reason it disappears when it is touched.

I showed how it is setup in the editor and the other pictures show one of the other 3 buttons that aren't affected.  The code it calls simple sets 2 bool variables.

Code: [Select]
public class PauseButton : MonoBehaviour {

public TimerCountdown script;

void OnClick() {
script.timerActive = !script.timerActive;
script.gamePaused = !script.gamePaused;
}
}

One thing to note is it seems to happen once the player starts moving.  and as I noted above and must stress this...

This is the ONE and ONLY button that is having this problem and I really DON'T know what is happening.  I need some help ASAP as this is holding me up from release.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Wierd Disappearing Sprite issue.
« Reply #1 on: April 28, 2013, 01:05:15 am »
Any difference between them? Are they all at the same z distance? Just trying to find any clues as to why its happening. As you aren't doing anything special in there it doesn't look very suspicious.

If the z is different, could this by some chance be the one closest or furthest away from the camera?

CoderBear

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Wierd Disappearing Sprite issue.
« Reply #2 on: April 28, 2013, 02:22:09 am »
They are all a z of -50 (camera is z of -150).

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Wierd Disappearing Sprite issue.
« Reply #3 on: April 28, 2013, 11:47:15 am »
I suggest writing some debug code to try and work out what is going on.

Write something which will find the object by name / keep a reference to it, and then print out the position, meshfilter.sharedMesh, etc. This looks like something Unity is doing funny.

CoderBear

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Wierd Disappearing Sprite issue.
« Reply #4 on: April 28, 2013, 08:37:42 pm »
I have some additional information.  I tried moving one of the buttons to just above the pause button (NGUI006).  Now the pause button works fine every time (NGUI007).  However now when you press the now moved button.  You see that it now changes to the pause button when pressed (NGUI008), yet it will still do the function it is programmed to do.  (that is when it is pressed after the picture changes to the pause button it does not bring up the pause screen).  You'll see other buttons acting just fine (NGUI009).

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Wierd Disappearing Sprite issue.
« Reply #5 on: April 28, 2013, 10:28:42 pm »
Being position dependent makes absolutely no sense there.

Just to rule things out can you:
1. Put these 4 buttons into a blank scene and see what happens there.
2. You're not changing the sprite from the button right? If you are, please turn that off to see the effect, if any.
3. Is there a rigidbody on the button? If not, try adding one, and set isKinematic = true.
4. What if you remove the target to the button? So basically, make it so the buttons press but don't actually do anything beyond that.

CoderBear

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Wierd Disappearing Sprite issue.
« Reply #6 on: May 02, 2013, 11:05:26 pm »
Still unsure of what was causing this issue.  but it is fixed by doing as shown in the attached photo.  Still not sure why the happened to fix it or why it was happening at all.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Wierd Disappearing Sprite issue.
« Reply #7 on: May 02, 2013, 11:08:56 pm »
wait is the camera perspective?

CoderBear

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Wierd Disappearing Sprite issue.
« Reply #8 on: May 03, 2013, 12:17:57 am »
nope it is orthographic.  and has the td2k camera script attached to it.