Author Topic: Create Widget Wizard unavailable  (Read 7698 times)

sybixsus

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Create Widget Wizard unavailable
« on: December 12, 2013, 10:52:23 PM »
It's been a little while since I worked with NGUI but I've come back to make some UI changes and I can't create widgets. When I choose "Create a Widget" from the NGUI menu, am I not supposed to get a wizard menu pop up to choose the type and settings? When I choose "Create a Widget" nothing happens at all. I'm using Unity 4.3.1f1 and it appears to be version 2.21 of NGUI. if an update is required, is there a version pre 3.0 which will work? I am a long way into a major project and would prefer not to break everything at this stage.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Create Widget Wizard unavailable
« Reply #1 on: December 13, 2013, 05:39:03 AM »
2.2.1 is extremely old. Like a year and a half old.

If you can't go up to the NGUI 3, go up to NGUI 2.7.0: http://www.tasharen.com/ngui/ngui270.unitypackage

sybixsus

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: Create Widget Wizard unavailable
« Reply #2 on: December 13, 2013, 05:12:59 PM »
Right, I've upgraded to 2.7.0.

There is no create widget option now, so I tried Open the Widget Wizard - which I assume is the same thing. As it did with 2.2.1, it does absolutely nothing.

Also, all of my text-wrapping is now broken. (I fixed the errors caused by the API changes, but the same values are producing completely wrong results now.)

Additionally, I have a UITexture which has a rendersurface linked to it, and renders the contents of a camera as part of my UI. That's now completely white all of the time instead of showing my rendertexture contents.

Any ideas or tips where I can begin fixing all of this? Also, some idea how I can start creating widgets again would be great.

Or am I better off ripping this all back out again and going back to 2.2.1, which at least worked. Since we now know that upgrading to 2.7.0 didn't fix the problem I was reporting, perhaps that's the best bet?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Create Widget Wizard unavailable
« Reply #3 on: December 13, 2013, 05:35:53 PM »
Sometimes Unity bugs out and can't open certain windows. Or rather they are open, but somewhere off-screen. Reset your layout, and you should be able to open it again. Considering the magnitude of changes from 2.2.1 to 2.7.0, and how long ago both versions were released, there isn't a whole lot I can do at this point.

sybixsus

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: Create Widget Wizard unavailable
« Reply #4 on: December 13, 2013, 08:36:25 PM »
Well I've reverted to 2.2.1 and I've managed to get the Wizard showing again. Thanks for the tip on re-setting the layout. That seems to have done the trick. Perhaps it was the Window from another plugin which was interfering.

I would still like to update to a more recent version at some point - though not necessarily right now. Do you have any thoughts on major changes which happened to UITexture and UILabel->WrapText and UILabel->GetPrintedSize which I should be aware of? I don't expect you to fix bugs in code you don't have spread over numerous updates in NGUI, but if you have any thoughts on a jumping off point so I at least have an idea of where to begin or what to look into, it would be very helpful.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Create Widget Wizard unavailable
« Reply #5 on: December 14, 2013, 04:13:58 AM »
Nothing off the top of my head. As I mentioned, both were released quite a while ago and I simply don't remember that far back.

sybixsus

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: Create Widget Wizard unavailable
« Reply #6 on: December 15, 2013, 02:05:45 PM »
Well it seems as though you're applying a default material and shader to UITexture's, whereas before you were happy to leave them as null if that's the way I created them. I was detecting the null material and then creating a dynamic material at runtime and applying it. Detecting the name of the default material's shader seems like a perfectly acceptable solution for now, but I can no longer render my UITexture with a transparent background. I've tried but I cannot seem to find any kind of solution for this. My shader, material, etc. are all fine because it works perfectly with earlier versions of NGUI. However, with 2.7.0, my UITexture has an opaque white background. It's almost as though it's not using my shader, even though the material assignment at runtime appears to suggest that it is.

EDIT: I found two properties which sounded relevant, but they're both read-only, so I cannot change them. The values are as follows:

PreMultipliedAlpha: False
HasDynamicMaterial: False

Are these values correct for trying to render a RenderSurface which has a transparent background? If not, how do I go about changing them?

I'm setting the UITexture->Material to my material, which already has my custom shader attached to it. It all works perfectly in old versions of NGUI.
« Last Edit: December 15, 2013, 03:30:34 PM by sybixsus »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Create Widget Wizard unavailable
« Reply #7 on: December 15, 2013, 04:25:21 PM »
In 2.7.0 the default texture used by UITexture is "Unlit/Texture", which doesn't use alpha. Use "Unlit/Transparent Colored" instead.

In 3.X it always uses the Transparent Colored.

sybixsus

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: Create Widget Wizard unavailable
« Reply #8 on: December 15, 2013, 07:02:48 PM »
As I explained above, I'm using a custom shader, and the shader works fine in 2.2.1. What's the correct way of changing the shader? I'm just changing the UITexture.material property to a material which uses my shader. If I check the inspector, while it's running, my material shows on the UITexture and my shader shows on the material, but it's not rendering correctly.


Also, since I upgraded to 2.7.0, NGUITools.SetActiveSelf() seems to be affecting children as well as the parent. Is this intended?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Create Widget Wizard unavailable
« Reply #9 on: December 16, 2013, 08:49:47 AM »
You can't change the widget's material as a copy of it is used. UIWidget.drawCall.dynamicMaterial gives you the material you could modify.

I would suggest you specify the shader on the UITexture instead, however. Don't modify the material.

SetActiveSelf simply calls gameObject.SetActive, a Unity function. As far as I know this hasn't changed in a long time.

sybixsus

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: Create Widget Wizard unavailable
« Reply #10 on: December 16, 2013, 04:26:09 PM »
Thanks. I'll try modifying the shader and leaving the material alone. That should suffice, as I don't think the material has any non-default settings.

As far as I know, SetActive() does now affect children as well. The documentation for SetActiveRecursively() says that it is deprecated because SetActive() now traverses the hierarchy. I can't see any flag on SetActive to specify whether it does or doesn't. I will have to adapt my code to fit.

Thanks.