Author Topic: UITexture disappears  (Read 17581 times)

ferretnt

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: UITexture disappears
« Reply #15 on: August 22, 2012, 02:57:50 PM »
I'm seeing the same issue - in my panel I have six buttons displaying UITextures (they're showing user-generated textures and not during gameplay so atlasing isn't an issue.)

When I hit "play", the UITexture textures are semi-randomly cleared, that is, by the time I've played the game three or four times they're all reset. Looking at the diffs of my scene file in source control confirms this.

For now, I've created a material per button as RocketPop suggested, but it would be great to confirm this issue still exists and it's nothing else I'm doing.

To confirm, is the UITexture script for download above identical to that included in 2.1.4a? I can't see any difference.

Thanks,
Alex

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UITexture disappears
« Reply #16 on: August 22, 2012, 03:11:52 PM »
UIWidget is what changed there, so I'd look at that one.

ferretnt

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: UITexture disappears
« Reply #17 on: August 22, 2012, 03:56:56 PM »
I'm confused - I saw a download of UITexture.cs in this thread previously. Didn't see a download of UIWidget.cs though.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UITexture disappears
« Reply #18 on: August 22, 2012, 04:30:01 PM »
Grab 2.1.5 and see if it still happens.

ferretnt

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: UITexture disappears
« Reply #19 on: August 22, 2012, 05:33:15 PM »
Still broken (but, I think, slightly different, it's difficult to flip backwards and forwards between versions) behaviour.

Now, it looks like I never lose ALL of the UITextures - one of them (and which one is non-deterministic) always seems to survive.

Here's my repro steps:
1. Make a panel.
2. Make a Button.
3. Delete the UILabel component from the button. Replace it with a UI Texture.
4. Bias the label (UITexture) element forward in Z (otherwise it won't sort in front of the background.)
5. Duplicate that button a bunch of times.
6. Assign a different texture to each UITexture.
7. Start/Stop the app in the editor a couple of times

I should add that the UITextures are set to null in the inspector (they're not just depth-sorted away or anything dumb like that.)

Let me know if you can't repro that and I'll send you my UI Testbed Scene.

I see a large volume of diffs with 2.1.5 - thanks for all the work!

Seigman

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Re: UITexture disappears
« Reply #20 on: September 14, 2012, 06:59:09 AM »
I have the same issue with UITextures. If I remove the line where mTex is set to null in UIWidget.set_material then this problems goes away...

itszander

  • Guest
Re: UITexture disappears
« Reply #21 on: September 14, 2012, 08:31:49 AM »
Hi all,
I am also have the same problem. I am working with Unity 3.5.5.f3 and nGUI 2.1.6.

I've tried the following

1. downloaded the UItexture.cs referenced in the previous post. This gave me a compile error override error. I tried to fix this but then the UItexture sprites were no longer visible.

2. I reverted to the UITexture that shipped with 2.1.6 but I can't find reference to either mTEX or the Null object specified in the previous post.

This is a big problem because I can't go any further on this UI implementation without my UItexture sprites staying visible.

HELP?!

Thanks.

-zander

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UITexture disappears
« Reply #22 on: September 14, 2012, 08:34:46 AM »
That reference is in the UIWidget class, Zander. It's the class UITexture derives from.

itszander

  • Guest
Re: UITexture disappears
« Reply #23 on: September 14, 2012, 08:52:01 AM »
hi,
I should note that I am not a programmer but have one here helping me.

I opened UIwidget.cs and looked for the MTEX = null references listed above. I couldn't find a UIWidget.set_material reference anywhere. Thus,  I don't know what to change.

?

-zander

(thanks!)

itszander

  • Guest
Re: UITexture disappears
« Reply #24 on: September 14, 2012, 12:13:39 PM »
Hi all, I made this change. IS it correct?

   public virtual Material material
   {
      get
      {
         return mMat;
      }
      set
      {
         if (mMat != value)
         {
            if (mMat != null && mPanel != null) mPanel.RemoveWidget(this);

            mPanel = null;
            mMat = value;
             /// mTex = null;

            if (mMat != null) CreatePanel();
         }
      }
   }

   /// <summary>
   /// Returns the texture used to draw this widget.
   /// </summary>

itszander

  • Guest
Re: UITexture disappears
« Reply #25 on: September 14, 2012, 04:06:17 PM »
Update... I fixed this by grabbing the new UItexture.cs script.  I thought I did it before, but apparently did not.

Dover8

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 20
    • View Profile
Re: UITexture disappears
« Reply #26 on: April 03, 2013, 09:33:25 AM »
Digging up an old post, but I'm experiencing this too now. Using Unity 3.5.2 and NGUI 2.3.1.

My scenario is that I have created 3D data panels that get populated at run time. (See the attached image for the layout, should be fairly self explanatory). I also have a 2D filter panel for choosing which data is shown on the 3D panels. I think I have narrowed it down to only happening when all the filters are turned off, and therefore the Table has no children, but the issue happens so sparsely and otherwise randomly that it is hard to say for sure. It also only ever happens with the first 3D panel you open at any time (i.e close all open panels, open one it will be broken, open another without closing the broken one and the new one will be fine and you won't get another broken one again until all other panels are closed first).

You can't see this in the image I posted, but data items are added to the table by an empty gameObject with a pair of UILabel children.

What you can see in the inspector image is that even though the textures aren't appearing on the panel, they are set in the inspector. If I go onto the inspector and update the sprite (even to the same one it already has) then it comes back on in the game view.

I have tried to suggestions in this thread, none of which worked.

Inspector view:


Working:


Not working:

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UITexture disappears
« Reply #27 on: April 03, 2013, 02:48:21 PM »
First thing you should do is update to the latest version of both Unity (3.5.7) and NGUI (2.5.1). I never support older versions.