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

Pages: [1] 2 3
1
NGUI 3 Support / File encrypted or not a database
« on: January 10, 2016, 10:00:01 AM »
Hi,

I'm trying to load up an old project which is build in Unity3D 4.5.5 and uses an old version of NGUI. Now I can't seem to load up the project since it throws a fatal error: File encrypted or not a database, on the file Unlit - Dynamic Font.shader. When I delete the shader it throws the same fatal error on another shader. When I remove all the shaders the project will load up fine but without shaders... Any way to fix this without removing all the shaderd?

EDIT:

Tried removing everything of NGUI open the project and import the latest version. On importing (latest version from the asset store), I keep getting the same Fatal Error on Unlit - Depth.shader


Thx!

2
NGUI 3 Support / UILabel 2nd character in string not always readable
« on: December 01, 2014, 09:00:18 AM »
Hi,

I'm having a problem with my App. I've switched from iOS to Android to finish the Android version (this bug didn't happen on iOS) but there seems to be a bug in the UILabel. I'm using UIFont since dynamic fonts are bugged in Unity3D. Check the screenshot below:


The grabled character is supposed to be an 'n'.

I'm scale tweening the this screen from 0.001f to 1f and sometimes the text (only 2nd character) of the label below the button is garbled. This also happens when there are more items in the list, but only to one item and only the 2nd character.

I'm using the latest NGUI version from the Asset Store and Unity 4.5.5p1 (because of orientation issues in Unity 4.5.5p5).

3
NGUI 3 Support / Texture2D.readpixels on Android with scaling
« on: October 03, 2014, 05:00:10 AM »
Hi,

I'm trying to make a screenshot of an object in my GUI.
I'm using this code:
  1. public class TakeScreenShot : MonoBehaviour
  2. {
  3.         public int      startX,
  4.                                 startY,
  5.                                 width,
  6.                                 height;
  7.  
  8.         private IEnumerator ScreenShot()
  9.         {
  10.                 Debug.Log ("Grabbing texture!");
  11.                 Texture2D tex = new Texture2D(width, height, TextureFormat.RGB24, false);
  12.                 yield return new WaitForEndOfFrame();
  13.                 tex.ReadPixels(new Rect(startX, startY, width, height), 0, 0);
  14.                 tex.Apply();
  15.                
  16.                 Destroy(tex);
  17.                 byte[] bytes = tex.EncodeToPNG();
  18.                
  19.                 File.WriteAllBytes(Application.persistentDataPath + "/Banknote.png", bytes);
  20.                 StartCoroutine(ScreenshotManager.SaveExisting( bytes, "banknote"));
  21.         }
  22.  
  23.         public void CaptureImage(bool send)
  24.         {
  25.                 StartCoroutine("ScreenShot");
  26.         }
  27.  
  28.         public void SetCameraSettings(int x, int y, int width, int height)
  29.         {
  30.                 startX = x;
  31.                 startY = y;
  32.                 this.width = width;
  33.                 this.height = height;
  34.         }
  35. }
  36.  

The screenshot i'm taking is of the banknote (beige one in the picture below):



Now since i'm making this App on Android NGUI Scales everything on the resolution (and it works perfectly). But here's where the problem rises. Since the GUI scales on resolution the width of the screen changes (banknote stays the same width and height). What i'd like to do is calculate the difference between the left edge of the screen and the left edge of the banknote and the top edge of the screen and the top edge of the banknote. See the picture below:



The value that comes out of that calculation should function as the startX and startY position of the readpixels function. What is the best way to calculate this?

4
Hi,

I'm having some trouble with a ScrollView i'm creating. I'm having the user fill in some text and settings in a Panel. When the user taps on Done, it then instantiates a prefab in the Timeline. The user is able to fill in as much text as he wants to so for instance the height of a Timeline item can be 500 pixels or 800 depending how much text is filled in. So how do I add this prefab to a Grid or UITable with the variable height? I'm guessing I need to use a UITable, but how does that exactly work when adding the items dynamically and resizing the widget height?

5
NGUI 3 Support / UIInput & Validation problems on Android
« on: July 10, 2014, 09:11:40 AM »
Hi,

I'm having some weird problems with the UIInput and Validation of the input on Android.
I've added these lines to the UIInput script:
In the Validation enum
  1. Decimal
  2.  

In the Validate function
  1. else if (validation == Validation.Decimal)
  2. {
  3.         //Decimal numbers
  4.         if (ch >= '0' && ch <= '9') return ch;
  5.         if (ch == '-' && pos == 0 && !text.Contains("-")) return ch;
  6.         if (ch == ',' && !text.Contains(",")) return ch;
  7. }
  8.  

This works perfectly on my mac. But when running on my Samsung Galaxy Tab I can't add the comma in my input field. Also when the input validation to float, I can't seem to add the '.' character.

The other problem i'm having is when setting the Hide Input to true, the input field is hidden but the backspace isn't working anymore.

My UIInput settings:


Any idea how to fix these problems?

6
NGUI 3 Support / Adding item to UIGrid on index 0
« on: July 07, 2014, 08:24:42 AM »
Hi,

What is the best way to add a child object in a scrollview's grid to index 0. I want my new items added to the top of the scrollview, and not at the bottom.

Thx!

Edit:
I'm using this code to add the items to the grid:
  1. public void AddItem(int smiley, int painvalue, int catagory, string notes, string exercise)
  2.         {
  3.                 GameObject clone = NGUITools.AddChild(Grid.gameObject, TimeLinePrefab);
  4.  
  5.                 UISprite[] sprites = clone.GetComponentsInChildren<UISprite>();
  6.  
  7.                 /*
  8.                  * sprites[0] = excercise sprite
  9.                  * sprites[2] = smiley
  10.                  */
  11.                 sprites[0].spriteName = exercise;
  12.                 SetSmile(smiley, sprites[2]);
  13.  
  14.                 UILabel[] labels = clone.GetComponentsInChildren<UILabel>();
  15.  
  16.                 if(labels != null)
  17.                 {
  18.                         /*
  19.                  * labels[0] = MiddleText
  20.                  * labels[1] = MiddleHeader
  21.                  * labels[2] = BottomText
  22.                  * labels[3] = Exercise_Body
  23.                  * labels[4] = Exercise_Header
  24.                  * labels[5] = PainValue
  25.                  */
  26.                        
  27.                         labels[0].text = "temp text";
  28.                         labels[1].text = now.ToString("dd:MM:yyyy");
  29.                         labels[2].text = notes;
  30.                         labels[3].text = exercise;
  31.                         SetCatagory(catagory, labels[4]);
  32.                         labels[5].text = painvalue.ToString() + "%";
  33.                 }
  34.  
  35.                 itemCounter++;
  36.                 clone.name = itemCounter.ToString();
  37.  
  38.                 currentItem = new Timeline();
  39.                 currentItem.Smile = smiley;
  40.                 currentItem.Pain = painvalue;
  41.                 currentItem.Notes = notes;
  42.                 currentItem.Exercise = exercise;
  43.                 currentItem.Date = now.ToString("dd:MM:yyyy");
  44.                 DM.CreateNewTimeLineItem(currentItem);
  45.  
  46.                 Grid.Reposition();
  47.                
  48.         }
  49.  

7
NGUI 3 Support / TweenScale and UIButton / UILabel problems
« on: June 23, 2014, 07:57:57 AM »
Hi,

I have the following screen:
-Container
--Panel
---ScrollView
----Grid
-----Button01 container
------ButtonSprite
------ButtonLabel
-----Button02 container
------ButtonSprite
------ButtonLabel
-----Button03 container
------ButtonSprite
------ButtonLabel

With a total of 14 buttons.

The screen get's TweenScaled to Vector.One when the user clicks on a button and when the user clicks a button in the scrollview is scales back to the starting state.

The starting state of the screen is:
x: 0.01f
y: 0.01f
z: 0.01f

When TweenScaling not all buttons should be active so sometimes the first 5 buttons are active and sometimes all the buttons are active. The problem I'm having, is when I TweenScale the screen get's active but doesn't always show the label below the buttons or even the whole button with the labels. When I click on the button the label show up. When I look in the Hierarchy the buttons are active, the labels are active but they won't show up :(.

8
NGUI 3 Support / Pulling widgets forward through script
« on: June 18, 2014, 09:54:00 AM »
Hi,

I'm having a depth problem with NGUI version 3.5.6. I'm using LocalNotifications, and when the app receives a LocalNotification it starts the app and should go to appropriate panel (screen). The panel can also be accessed through menu and that works fine. What happens is when the localnotification triggers the callback (so i know which localnotification is fired) it tweens to the correct panel but the screen stays white. I debugged it and I know for sure the panel = active, the panel position is Vector3.zero so it's on screen. Is there any way to pull all widgets in a screen forward?

So OnLocalNotificationFired("WMoment") is the one i'm testing right now.

Here's my code:

  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class LocalNotifCallbacks : MonoBehaviour {
  5.  
  6.         public AppSettings settings;
  7.         public WeightRegistrationManager WRM;
  8.         public SlideMenuManager SMM;
  9.         public DatabaseEventManager DEM;
  10.  
  11.         public GameObject[] PanelWidgets;
  12.  
  13.         public UIButton[]       WMButtons,
  14.                                 MotivButtons;
  15.  
  16.         private GameObject activePanel;
  17.         private Vector3 panelVector;
  18.  
  19.         private EventDelegate   evi,
  20.                                         WMEvi;
  21.  
  22.  
  23.         private void Start()
  24.         {
  25.                 if(!PanelWidgets[30].gameObject.activeSelf)
  26.                         panelVector = PanelWidgets[30].transform.localPosition;
  27.                 else
  28.                         panelVector = PanelWidgets[29].transform.localPosition;
  29.  
  30.                 evi = new EventDelegate(this, "TurnOff");
  31.                 evi.oneShot = true;
  32.  
  33.                 WMEvi = new EventDelegate(this, "TurnOffWM");
  34.                 evi.oneShot = true;
  35.         }
  36.  
  37.         #if UNITY_IPHONE
  38.         public void OnEnable() {
  39.                 LocalNotifs.OnLocalNotificationFired += OnLocalNotificationFired;
  40.                 LocalNotifs.OnSetLocalNotification += OnSetLocalNotification;
  41.         }
  42.         public void OnDisable() {
  43.                 LocalNotifs.OnLocalNotificationFired -= OnLocalNotificationFired;
  44.                 LocalNotifs.OnSetLocalNotification -= OnSetLocalNotification;
  45.         }
  46.        
  47.         #endif
  48.        
  49.         public void OnSetLocalNotification()
  50.         {
  51.                 //Does nothing atm
  52.         }
  53.        
  54.         //Fires when returning from suspended and responded to localnotification
  55.         public void OnLocalNotificationFired(string id)
  56.         {
  57.                 switch(id)
  58.                 {
  59.                         case "MP01":    SetMPPanelOptions();
  60.                         break;
  61.  
  62.                         case "MP02":    SetMPPanelOptions();
  63.                         break;
  64.                                
  65.                         case "WMoment": SetWMPanelOptions();
  66.                         break;
  67.                 }
  68.         }
  69.        
  70.         public void WMBack()
  71.         {
  72.                 activePanel.SetActive(true);
  73.                 TweenPosition.Begin(PanelWidgets[23], settings.SpeedOfTweens, panelVector);
  74.                 TweenPosition.Begin(activePanel, settings.SpeedOfTweens, Vector3.zero).onFinished.Add(WMEvi);
  75.  
  76.         }
  77.  
  78.         private void SetMPPanelOptions()
  79.         {
  80.                 activePanel = CheckActive();
  81.  
  82.                 if(activePanel != null)
  83.                 {
  84.                         MotivButtons[0].gameObject.SetActive(false);
  85.                         MotivButtons[1].gameObject.SetActive(false);
  86.  
  87.                         PanelWidgets[4].SetActive(true);
  88.  
  89.                 }
  90.         }
  91.  
  92.         private void SetWMPanelOptions()
  93.         {
  94.                 activePanel = CheckActive();
  95.  
  96.                 if(activePanel != null)
  97.                 {
  98.                         WMButtons[0].gameObject.SetActive(false);
  99.                         WMButtons[1].gameObject.SetActive(true);
  100.  
  101.                         DEM.GetWeightMoment();
  102.  
  103.                         PanelWidgets[23].SetActive(true);
  104.                         TweenPosition.Begin(activePanel, 0, -panelVector);
  105.                         TweenPosition.Begin(PanelWidgets[23], 0, Vector3.zero).onFinished.Add(evi);
  106.  
  107.                 }
  108.                 else
  109.                 {
  110.                         Debug.Log ("ActivePanel = null :(");
  111.                 }
  112.         }
  113.  
  114.         private GameObject CheckActive()
  115.         {
  116.                 foreach(GameObject obj in PanelWidgets)
  117.                 {
  118.                         if(obj.activeSelf)
  119.                         {
  120.                                 return obj;
  121.                                 break;
  122.                         }
  123.                 }
  124.  
  125.                 return null;
  126.         }
  127.  
  128.  
  129.         private void TurnOff()
  130.         {
  131.                 activePanel.gameObject.SetActive(false);
  132.         }
  133.  
  134.         private void TurnOffWM()
  135.         {
  136.                 WMButtons[1].gameObject.SetActive(false);
  137.                 WMButtons[0].gameObject.SetActive(true);
  138.                 PanelWidgets[23].gameObject.SetActive(false);
  139.  
  140.         }
  141.  
  142. }
  143.  
  144.  

9
Hi,

I think I found a bug in the latest version of NGUI (3.6.2). When setting the keyboard type to HideInput on a textfield with multiple lines, it still shows the inputfield above the keyboard but it isn't inputting anything there just in the textfield where it should be.

Steps to reproduce:
1. Create a Textfield with multiple lines
2. On the UIInput set the keyboard type to HideInput
3. Run it on your mobile device (I used the iPhone 5s)

EDIT:
It seems that Unity3D doesn't support hiding the Inputfield above the keyboard when using multi-line textfields:
http://docs.unity3d.com/ScriptReference/TouchScreenKeyboard-hideInput.html

10
NGUI 3 Support / UIInput and ScrollView on Mobile
« on: June 02, 2014, 03:19:03 AM »
Hi,

I've upgraded to the latest version of NGUI and i'm having some problems getting my old script working again. It's used to turn off the colliders of the InputFields when scrolling in a scrollview.
The Hierarchy of my scrollview:
ScrollView
-TextBox01 (UIinput)
 -Label

When the user scrolls the scrollview on iOS or Android the touch keyboard shouldn't pop up. So I created this script:
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class ClickCancel : MonoBehaviour {
  5.  
  6.         public BoxCollider col;
  7.  
  8.         public void OnDragStart()
  9.         {
  10.                 col.enabled = false;
  11.         }
  12.  
  13.         public void OnDragEnd()
  14.         {
  15.                 col.enabled = true;
  16.         }
  17. }
  18.  

But no matter what I do the TouchscreenKeyboard pops up whenever I scroll over the TextBox in my ScrollView. Any idea how to fix this?

11
NGUI 3 Support / Creating PNG from GUI object
« on: April 30, 2014, 03:12:36 AM »
Hi,

I'm trying to create a PNG of a part of the NGUI UI which is customizable by the user. The object i'm trying to create a PNG of consists of the following objects:
UITexture
 -Sprite
 -Sprite
 -label

I've tried using readpixels but I can't get the position right. I also tried using a render texture but that only gives me a black texture in the end. Is NGUI providing something like this to create a PNG from UI object? If not how would I achieve this?



12
NGUI 3 Support / swipe + tap question
« on: March 20, 2014, 08:50:51 AM »
Hi,

I'm having some trouble figuring out how I should make a functionality which is available in iOS. The functionality i'm targetting is for instance, in the Mail app on iOS when you want to remove a mail, you swipe / drag over the email (button) and 2 new buttons appear (More and Archive). I want this feature in my GUI for buttons in a ScrollView. Any idea or hints how to approach this functionality?

Check out this video @0.37 seconds
https://www.youtube.com/watch?v=hZWrbCeuHMk

13
NGUI 3 Support / NGUI Timeline scrollview memory management
« on: March 18, 2014, 06:22:45 PM »
Hi,

I'm testing out building a Timeline in my Unity3D project. And I would like to know what you guys think would be the best approach conserning memory management. Let's say we have a ScrollView in which Timeline events are dynamically added to the scrollview. A Timeline item consists of 3 sprites (from the same atlas) and 3 labels. In my Database I have an event table which holds 20 timeline events which need to be shown in the Timeline scrollview.

What would be the best approach in terms of memory management? Would this be pooling? Or destroying and adding new buttons when the scroll amount reaches a certian threshold?

Example the first 10 items are loaded and when the 11th item should be visible the first item is destroyed. When scrolling back the first item get's created and the 11th item destroyed and so on.

Any ideas?

14
Hi,

I'm having some problems with a ScrollView and a UIGrid. At some point in my app I want all the buttons in the Grid destroyed and add a new empty button to the first position after all the buttons in the grid are destroyed. I'm using this code to destroy all buttons in the grid:
  1. private void ClearScrollView()
  2. {
  3.         Debug.Log ("Clearing scroll view");
  4.         UIButton[] bt = Grid.GetComponentsInChildren<UIButton>();
  5.  
  6.         for(int x = 0; x < bt.Length; x++)
  7.         {
  8.                 Destroy (bt[x].gameObject);
  9.         }
  10.  
  11.         buttonCounter = 0;
  12.         AddNewButton();
  13. }
  14.  

And i'm using this code to Add the new button:
  1. private void AddNewButton()
  2. {
  3.         GameObject clone = NGUITools.AddChild(Grid, ButtonPrefab);
  4.         UIEventListener.Get (clone).onClick += TweenPanel;
  5.         buttonCounter++;
  6.         clone.name = buttonCounter.ToString();
  7.         CurrentButton = clone;
  8.         Grid.GetComponent<UIGrid>().Reposition();
  9. }
  10.  

And my UIGrid settings:
Arrangement = Vertical
Sorting = none
max per line = 0
Cell Width = 640
Cell Height = 105
Animate smoothly = true
Hide inactive = true
Keep within panel = false

So for example I have 2 buttons in my Grid, and I call ClearScrollView. The buttons get destroyed and a new button is added to the Grid, the problem is the new button is not at position Y = 0 but at position Y = -315. And When I have one button in the Grid it repositions the new button to Y = -105 instead of Y = 0.

Any idea what could cause this problem and how I can fix this problem?

15
NGUI 3 Support / UIButton disabled state bug
« on: March 13, 2014, 10:35:52 AM »
Hi ArenMook,

I think I have found a bug which appears when setting the UIButton.isEnabled = false;

I'm calling UIButton.isEnabled = false on a panel then the button is grey color (disabled color). But when I turn off the panel and turn the panel back on, the button is disabled but it has the normal color of the button.

How to reproduce:
Create button with a normal, hover and disabled color.
Disable the button at runtime
Turn the panel which holds the button off and back on.
The button now has the normal color instead of the disabled color

Pages: [1] 2 3