Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - sybixsus

Pages: [1]
1
NGUI 3 Support / Changing UITexture Material Property in 2.7
« on: April 05, 2014, 08:02:10 AM »
Hi,

I'm trying to change a material property of a UITexture object. I'm using NGUI 2.7, as I'm deep in a complex project.

I'm using a custom shader which has the following property :

  1. _Alpha ("Panel Alpha", Range(0,1)) = 0.1
  2.  

And this is confirmed working. Whatever value I put as the default value is the final alpha value of the shader.

I create and apply my own material to the UITexture.

  1. DynamicMaterial = GameObject.Instantiate(DynamicPortrait.material) as Material;
  2. DynamicPortrait.material = DynamicMaterial;
  3.  

I set the texture at various points because it's dynamic :

  1. DynamicPortrait.mainTexture = HT.GetTexture();
  2.  

And then finally I try to change the material property:

  1. DynamicMaterial.SetFloat("_Alpha", 1f);
  2.  

But it doesn't work.

I thought perhaps the UITexture might be creating a new material internally when I changed the main texture, so I tried :

  1. Material M = DynamicPortrait.material;
  2. M.SetFloat("_Alpha", 1f);
  3. DynamicPortrait.material = M;
  4.  

But that doesn't work either.

Could you tell me what I'm doing wrong here please? I'm not going to be able to switch to 2.7, and the custom shader is unavoidable as it does some fancy gradients.

2
NGUI 3 Support / 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.

3
NGUI 3 Support / Apostrophes in Labels
« on: May 10, 2013, 08:41:12 PM »
Hi,

For some reason, I don't get apostrophes in my UILabels when I set them programatically. If I enter the text manually in the editor, it seems to be working, so the font is clearly correct. I assume that this is a text encoding issue. The actual label text is a string which is built from string literals and a chunk of text from a Spaghetti Machine graph, and I set the UILabel.text property. Do I need to do some kind of encoding in order to make this work correctly?

EDIT: I just tested string literals alone and that works fine too. So I presume it's something from the text I'm getting from the Spaghetti Machine graph, but not sure what encoding you need or how I would go about it. Perhaps if you can tell me what it should end up as and the SM developer can tell me what it's starting as, I can fill in the gaps.


Regards

Phil

4
NGUI 3 Support / !IsFinite errors thrown by Editor
« on: October 04, 2012, 01:18:49 PM »
I'm getting a lot of Unity Editor errors thrown whenever I try to work with one of your sliced sprites. The sliced sprite in question is 1720 x 250 - more or less. The vertical scale goes up a bit more sometimes, but it's in that region. When I use a simple tween script to adjust the scale of the object to make it appear and disappear, I get these errors thrown:

!IsFinite(outDistanceForSort)
!IsFinite(outDistanceAlongView)

They are repeated a number of times, but those are the only two different errors.

I'm guessing that something in your editor scripts is trying to calculate something and ends up with a NAN, thus throwing the Editor error.

I've searched the forum and didn't find much. I found two threads which said Unity doesn't like the very large scales that NGUI encourages us to use. So I cut my virtual resolution down by 1/4, but the errors are still there. I also found some references suggesting that NGUI doesn't like negative scales, but I don't have anything scaled to a negative number, so I don't think that's it.

Pages: [1]