Author Topic: hard clipping is not working at run time  (Read 4094 times)

thrasher66099

  • Guest
hard clipping is not working at run time
« on: March 07, 2013, 05:04:11 PM »
I have sprites that need to be "crushed" at run time. I do this by setting the sprite in the center of the panel holding it with hard clip and reducing the clipping range x size over time. This was working yesterday but today something happened and the sprites are no longer clipped even though the clip panel x size is correctly being reduced. I reverted to my project from yesterday and the issue still persists.

Some extra information. Each sprite is the only object inside of its clip panel and there are no panels above the clipping panel. If I change the clipping size in the editor when the project is not running the sprite are correctly clipped. At run time they are not clipped.

I've tried reverting to versions that I know were working. I've tried restarting Unity, MonoDevelop, and my computer. Nothing is fixing the issue.

Any ideas of what the is going on? I'm at a loss.

dlewis

  • Guest
Re: hard clipping is not working at run time
« Reply #1 on: March 07, 2013, 05:16:58 PM »
The hard clip shader was marked as deprecated in the latest ngui because of issues. Try using alpha clip instead.

thrasher66099

  • Guest
Re: hard clipping is not working at run time
« Reply #2 on: March 07, 2013, 05:38:00 PM »
The hard clip shader was marked as deprecated in the latest ngui because of issues. Try using alpha clip instead.

I tried alpha clip as well and have the same issue.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: hard clipping is not working at run time
« Reply #3 on: March 08, 2013, 03:44:49 AM »
Make sure it's actually your clipping panel that's drawing the widget. It may have put on a different panel at run time, if you have instantiated it a weird place.

If it's doing it in the editor, then it should be easy to check.

thrasher66099

  • Guest
Re: hard clipping is not working at run time
« Reply #4 on: March 08, 2013, 09:46:33 AM »
I found the issue. I have a script that scales my scene on start based on the screen's aspect ratio. This obviously scales the panels and causes clipping to not work.

My new plan to fix the issue is change the sprites to progress bars and reduce their fill value over time. The only issue is I need to clip from both sides equally and not just from 1 side. Does anyone know how I might solve this?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: hard clipping is not working at run time
« Reply #5 on: March 09, 2013, 04:33:48 PM »
Offset the placement by the same value as the cutoff on the slider.

Although, if you need to "crush" them, why not just scale the sprite down directly?