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.


Messages - alexh0101

Pages: [1] 2 3
1
Hi there,

Thanks for that, it worked. I'm using a grid and this code:

  1. centerOnChildScript.CenterOn(Next_Page.transform);
  2.  

2
NGUI 3 Support / How can I drag a scroll view sideways from script?
« on: May 11, 2015, 04:20:45 PM »
I tried TweenPosition from script but when it gets called, the scroll view gets shifted, but the next cell doesn't show up in the grid (it's blank).

  1. scrollViewTween.from = new Vector3(theScrollView.transform.localPosition.x,0,0) ;
  2. scrollViewTween.to = new Vector3(theScrollView.transform.localPosition.x - cellWidth,0,0) ;
  3. scrollViewTween.PlayForward();

(This doesn't work properly)

How can I drag the scroll view to the next cell from the script?

3
Yes. Occam's razor approach. Attach UITButtonOffset to the button, target the label.

Hi thanks for your response.
The problem is with UIButtonOffset is that it doesn't offset if I drag the cursor out of the button without releasing my click. Is there a workaround? Maybe an improvement for next NGUI update?

Thanks

4
I'm using a button which has a label.
I selected a different sprite for when the button is pressed. This effect makes it look like the button is actually pressed down.

The problem: the Label doesn't move down along with the button when it's pressed.

I anchored the label to the top of the button's sprite.

But the problem is:
Since the "pressed" sprite is smaller than "normal" sprite (for obvious reasons), the "pressed" sprite gets stretched up, because the sprite is still subject to the same "size" attribute in UI2DSprite. So the pressing down effect fails.

If I try to solve this problem by making a "pressed" button of the same size as "normal" (with some transparent pixels in the top part), this doesn't solve my problem because the Label is anchored to the top of that sprite. This label won't move because the top of the sprite doesn't move (so the anchor is useless).

Is there a way I can shift a Label when the button is pressed?

EDIT: I'm trying to make a script that checks both OnPress() and OnHover() but the problem is that onPress() overrides OnHover(): OnHover(false) is not called if isPressed == true.  Would I have to make state booleans to solve that?

5
When my scene start and I press a UIButton for the first time, I get a 178ms lag.

In the Profiler, I see this:



But when I collapse the "UIButton.onClick", nothing appears with that 178ms.

Why is that happening?
If this is mandatory, is there a way to initialise whatever has to be initialised, while the scene is loading?

6
NGUI 3 Support / How to assign a button's OnClick by scripting?
« on: April 12, 2015, 08:14:10 PM »
I have a UIButton variable and a void function.
I want to assign this function upon Start().

Tried myButton.onClick *EQUALS* MyFunction() but this is not the right syntax for a delegate.

Thanks

7
If my scroll view has a grid of say 10 items, is there a way of knowing the the scroll view is currently centred on the nth item of the grid?

Also is there a callback function in NGUI when CenterOnChild has been executed, or do I have to do that manually?

8
I read the other threads related to Font.CacheFontForText().

They say it's related to dynamic font but I don't use any.
I am using only one font in a very big size and it's a bitmap font. I'm resizing this font to smaller sizes, depending on the needs.

I resized down that big font to about 10 different font sizes in the whole project. I also used 3 or 4 colour tints.

Why is Font.CacheFontForText() being called?
What should I do to avoid it?

Is it better to scale down the transform of a label instead changing the font size?

9
It seems that a font HAS to be part of an atlas to work in NGUI, is that right?

My problem is that I only use one font in the atlas and its file is 1024x650. So putting it in a 1024x1024 pixel atlas would be a waste of disk space.

Is it possible to use the font as a 1024x650 pixel image file?
Alternatively, is it possible to reduce the size of the Atlas to 1024x650?


10
Because of an issue of undeclared variable, I have to change the execution order of my scripts.

I put my problematic script right after "Default Time" in MonoManager (right before UIInput and UI2DSprite), but the problem is my draggable scrollview fails to spread its cells horizontally at Start() as it's supposed to: all the cells are on top of each other.

What did I do wrong? How did I mess up NGUI's scripts by just putting one of my scripts right after Default Time?

By trial and error I found that if I put my two problematic scripts at the top (above RealTime), the problem disappears. Would that cause a problem to NGUI if I execute these 2 scripts before NGUI scripts?

Thanks a lot

11
I have a draggable scroll view, with a grid and items generated at Start().

I want this scroll view to be contained in an object with a scale of (0,0,0), and then this object will get bigger later.

The problem is that, when I enlarge the parent object after Start(), the Unity2Dsprite's that are in every item of the grid are not displayed. Also the scroll view is not placed at the defined position.

However, when I change the scale of the parent object to (0.001, 0.001, 0.001), everything works perfectly.

So what is the difference between (0,0,0) and (0.001, 0.001, 0.001)?
Is the misplacement of the Scroll View a bug or is it supposed to be that way?

Thanks for your help.

12
I use PlayForward() on an object and its On-finished function is called as expected.

But when I PlayReverse and that same object, the On-finished function is called and I don't want that.

Also is there a way to have a different On-finished function in case of a PlayReverse?

13
NGUI 3 Support / How much space does NGUI take in the final build?
« on: February 22, 2015, 10:34:07 AM »
I use very few features of NGUI in my game, mainly UILabel, Unity2DSprite, UIButton, UIPanel and ScrollView.

How much disk space is usually used by NGUI in the final build of my game?

Thanks

14
I have object of which I want to change the Unity2DSprite's Color tint.

I read in an old thread that the presence of "mColor" in the Inspector is just a bug and it's not supposed to change the color tint.
So I tried to make an Animation event with the following:

public void ChangeTheColor() {
      the2DSprite.color = new Color32(220,60,51,255) ;
}

But when I go back to the Animation editor, this function is said to be "not supported".

Why is that and how can I change the color tint of my Unity2DSprite?

Thanks a lot

15
Hi there, thanks for your response.

It seems that the problem comes from UICenterOnChild, which is attached to the grid.
The items within that grid are instantiated in Start().

I tried to right-click on UICenterOnChild and "Execute", but it didn't change anything.
Is there a way of executing the UICenterOnChild script right after the instantiation of the items?


Pages: [1] 2 3