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 - Biggix

Pages: [1]
1
Hi,

I have a bunch of textures within a UIAtlas. I need to "extract" those textures from the atlas (in runtime) and have each one applied to a UITexture for a specific purpose. Textures are RGBA32.

However when I do the copying, the resulting textures are strangely offset by some non-constant Y value (around 512 in some cases). It's clear that something goes wrong around the GetPixels phase.

This is how I do it:
  1.  
  2. List<UISpriteData> spriteList = sourceAtlas.spriteList;
  3. spriteTextures = new Texture2D[spriteList.Count];
  4.        
  5. Texture2D src_tex2d = Instantiate(sourceTex) as Texture2D;
  6.  
  7.                 for (int i=0; i<spriteList.Count; i++) {
  8.                        
  9.                         UISpriteData data = spriteList[i];
  10.                        
  11.                         Color[] pix = src_tex2d.GetPixels(data.x, data.y, data.width, data.height);
  12.                         spriteTextures[i] = new Texture2D(data.width, data.height);
  13.                        
  14.                         spriteTextures[i].SetPixels(pix);
  15.                         spriteTextures[i].Apply();
  16. }
  17.  
  18.  


Please help!!

2
NGUI 3 Support / UIButton.onClick GC / Performance issue
« on: August 17, 2016, 02:56:21 PM »
I'm experiencing abnormally high GC amount upon UIButton.onClick. The stuff is strange. It's clear that there is some logging activity going on (!?) Any ideas on how to disable it and what kind of logs could be those? Hoping to see a constructive reply! Thanks!


3
NGUI 3 Support / Embed UISprite into UILabel as bbcode
« on: August 07, 2016, 12:57:58 PM »
Hi,

I need to embed a sprite from an existing atlas, into an UILabel string of characters (using atlased fonts), basically replacing one of the letters with a scaled sprite from other atlas (not the text one). These are not emoticons but in-game item images.

How could this be done?

4
NGUI 3 Support / UIButton EventDelegate list is empty
« on: May 15, 2016, 11:37:28 AM »
When I save a working UIButton into a prefab and then instantiate it during runtime in my game, the EventDelegate list (onClick) it was carrying goes empty and thus button doesn't do any actions.

Can you please share a bit of code for the recreation of the EventDelegate list with code after I instantiate it? For example, I need to execute SomeFunction() with SomeParameter that belongs to SomeScript on SomeGameObject.

Or maybe there is some other way to tackle this issue. Thank you!

5
NGUI 3 Support / UIProgressBar mip-map problem
« on: April 19, 2016, 12:12:32 PM »
Hi all,

I'm using a Sliced sprite with UIProgressBar. Everything is pretty obvious but I see a major detail decrease (stepping) upon decreasing the values of the slider. I think it's corellated with mip levels but I'm not sure where and how to adjust them. I tried adjusting the atlas texture the progressbar sprite comes from, but nothing changes. It seems that it creates a new (?) texture for the sliced sprite and I need to adjust the mip/aniso (?) parameters of that new texture.

Thanks!

6
NGUI 3 Support / Create Temporary UITexture Instead Of UISprite
« on: March 06, 2016, 12:15:51 PM »
Hi everyone and ArenMook,

I'm using some custom shaders to add life to my sprites. I need the effect to be working per 1 sprite at a single given time only.

However when my sprites are packed tightly into the atlas, of course there are problems: the shader effect applies to the whole atlas (all of the sprites), it leads to the slow execution and inconsistency of the effect across different sprites.

So I want to avoid the problems by making a temporary UITexture, displaying it right over the top of existing UISprite with the required shader for N seconds and then just disposing of it.

I would really appreciate if someone could help me with the code. I can't wrap my head around this seemingly simple task!

Thanks!

7
Hi,

I am using Unity 4.6.3 with the latest Chartboost SDK (11th March).

On iOS version, everything works fine.

On Android, the touches strangely trigger on both the interstitial/"X" button AND the underlying interface elements, resulting in unwanted UI interaction when user just wants to close the interstitial. Like the interstitial somehow passes the touches to the underneath layer, but it also performs the desired actions itself.

I have requested support from Chartboost but there is no reply.

Anybody knows what can be done? I thought of disabling and re-enabling the interface when the interstitial is displayed, but I don't know of a reliable way to do it without rewriting a massive chunk of the code.

8
NGUI 3 Support / Problems after updating to Android Lollipop
« on: March 12, 2015, 05:32:10 PM »
Hi,

I had a perfectly working game both on iOS and Android. Running Unity Pro 4.6 on Mac.

My Android test device is LG G3 and first it had Android 4.4 on it. Everything worked flawlessly. I didn't modify anything.

Now I updated the device to 5.0 Lollipop and strange stuff begins to happen. The game is running, but I can see only the background. The foreground objects are missing. Some of them are flickering from time to time and can be seen only on rare occasions for a fraction of a second. (I haven't figured what makes them to appear). Of course this doesn't happen on iOS.

What I did:
1) Checked I have the latest Android SDKs
2) Tried tinkering with the build options
3) ???

I suspect this has something to do with nGUI, as the game is totally built with nGUI elements. Not sure what to do from now on. Anyone has a clue?

9
NGUI 3 Support / UIProgressbar.value and Yield don't work together?!
« on: December 25, 2014, 06:44:43 PM »
Another issue which is driving me crazy.

I'm using a very simple coroutine to update gradually a value of an UIProgressBar.

  1. var go = GameObject.Find ("ProgressBack");
  2. UIProgressBar uil = go.GetComponent<UIProgressBar> ();
  3. float add=0.01f;
  4. float st=0f;
  5.  
  6.         for (var h=1; h<=20; h+=1) {
  7.                        
  8.                         uil.value =st+(add*h);
  9.                        
  10.                         yield return new WaitForSeconds (0.05f);
  11.                        
  12.                 }

The same code is used to adjust the value of a money counter in another similar IENumerator so it works and it is not the issue of the code itself.

It's something with the UIProgressbar. When I put debug info, it's clear the "for" cycle is executed only once for some unknown reason (instead of 20 times).

10
NGUI 3 Support / UIScrollView Performance: iOS vs Android
« on: December 20, 2014, 06:30:33 PM »
Hi,

So I'm still making this slots game, with moving reels based on 5 UIPanels with 5 Scrollviews. I noticed that the performance is very different for iOS and Android. iOS is clearly more sluggish, and I'm using the latest iPad Air/iPhone6 vs. LG G3/Sony Z1 Ultra. Notably, the performance on iOS is the same for iPad Air and iPad Mini 1st gen (which is more than twice slower with A5 processor compared to A7 processor of iPad Air). So it's not the processing power of the device, but something else. Android runs perfectly smooth.

I am curious if there are any ways to make the iOS performance on par with Android. I tried different build settings, now with Vertex lit rendering path and native resolution. Auto resolution (best performance) is a bit better but god it looks awful.

11
NGUI 3 Support / UIButton - sending event on touch down, not touch up
« on: December 19, 2014, 07:34:17 PM »
Hi,

I'm having a bunch of UIButtons. They work fine, however on iOS device they send info to script mentioned in the onClick field, when the user's finger is LIFTED from the button.

I really need the action to happen, just when the user touches the UIbutton, without waiting when he will lift the finger.

How do I accomplish this?

Thanks!

12
NGUI 3 Support / UIWidget onRender - how to use it?
« on: December 11, 2014, 12:33:23 AM »
Hello all,

Basically I have a bunch of UISprites, all contained within an UIPanel container. The sprites use a special material with an attached shader (Brightness).

I want to be able to control that Brightness parameter through code, and I tried all I could think of, it doesn't work, only manual setting before the build works fine.

I have found that I should use "UIWidget onRender" --> but how shall I use it? Where should I put it? What is the correct syntax to call this? Is there an example for my specific situation? Please help. Thanks!

13
NGUI 3 Support / ScrollView Y-position variable increasing endlessly
« on: December 09, 2014, 05:51:09 PM »
Hi,

I'm implementing a slots game and using 5 vertical ScrollViews for 5 reels with symbols on them.

I use a sequence of tweens to animate the ScrollReel.transform.localPosition and ScrollReel.GetComponent<UIPanel> ().clipOffset (inversed value). This works fine and I get the desired motion effect with nice bounces etc.

However I foresee a problem, the Y position of Transform (and it's inversed negative ClipOffset friend) tend to increase a good amount with every slots spin. This can lead to really big numbers after several thousands of spins and I'm afraid of overflows. And it's generally not too nice to let variables get this high. Also, the tweens somehow are not too precise and sometimes the reels do not stop at the exact position.

I've tried all I could think of, to reset ScrollReel Y back to 0 (this should do the trick, as the moving reel always stops at 0 object location)

1) This does the trick, but produces nasty flickering

  1. offset.y = 0.01f;
  2. ScrollReel.transform.localPosition = offset;

2) This does the trick, but is not invinsible to the user & leads to the reel disappearing ocassionally

  1. offset.y = 0.01f;
  2. SpringPanel.Begin (ScrollReel, offset, 1000000f);

What I'm looking for is a method to reset the Y coordinate of the ScrollReel back to 0, the sprites are the same, I just need to reduce the flickering and noticeable reel movement while doing that. I know a workaround (placing duplicate sprites in front of the scroll wheels) but it's painful & maybe you have better considerations. Maybe there's a way to turn off the draw calls while changing the Y location.

It's my first day in Unity so don't judge too strictly. Thanks!

Pages: [1]