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

Pages: [1] 2 3 4
1
NGUI 3 Documentation / Re: Tweens
« on: January 31, 2014, 01:47:18 AM »
(Correct any of this if it's wrong, but this is what I've come to understand...)

In order to make use of a tween's onFinished property, create a callback method and assign it via the EventDelegate.Add() method:

  1. void OnTween1Complete()
  2. {
  3.    // ...do stuff here...
  4. }
  5.  
  6. void MyButtonClicked()
  7. {
  8.    TweenScale tweenScale = TweenScale.Begin(gameObject, scaleAnimationTime, new Vector3(1.5f, 1.5f, 1.5f));
  9.    EventDelegate.Add(tweenScale.onFinished, OnTween1Complete);
  10. }
  11.  

Earlier implementations of UITweener allowed code such as:
  1.    TweenScale.Begin(gameObject, 1f, Vector3.one).onFinished += SomeMethod;
  2.  
but that has been deprecated in favor of the new format above.

2
NGUI 3 Documentation / Re: UIPanel
« on: November 28, 2013, 06:19:10 AM »
Could you clarify the static checkbox in regards to UILabels? Can we freely update UILabel.text values when the panel is marked as Static, especially if they scale or resize based on their Overflow settings?

3
NGUI 3 Documentation / Re: Tweens
« on: November 26, 2013, 11:50:58 PM »
I may have missed it, but does this also provide details on how to chain Tweens via code?

http://www.youtube.com/watch?feature=player_detailpage&v=uNSZsMnhS1o#t=73 discusses changes to how tweens work and are called, but it does not go into chaining them.

4
NGUI 3 Documentation / Re: Tweens
« on: November 26, 2013, 07:28:46 PM »
Could you provide an example of chained tweens? Like how to scale up an object, then rotate it once, then scale it back down?

5
NGUI 3 Support / Update the FAQ forum page
« on: November 26, 2013, 07:11:00 PM »
Several things changed between NGUI 2 and 3, and I would like to request the FAQ to either point to how-to's, documentation, or even those nice YouTube videos explaining how to do things.

For example, I used to use Tweens with
  1. TweenScale.Begin(gameObject, scaleTime, newScale).onFinished += MyOnTweenFinished;
I'm not sure how it's changed, or where to look to see how to do it now with 3.0.7. Do I use
  1. EventDelegate.Add(myTween.onFinished, MyOnTweenFinished);
or something else?

This, and other changes to NGUI, are many of my Frequently Asked questions.

EDIT:
Just saw that we're now getting a dedicated Documentation section (http://www.tasharen.com/forum/index.php?board=12.0). Yay!
So maybe the FAQ could point to either the entire section OR to individual threads, like http://www.tasharen.com/forum/index.php?topic=6760 (for Tweens).

6
Check the render depth that those UIWidgets are set to. Take a look here: http://www.youtube.com/watch?feature=player_detailpage&v=OT0hTxjjkY4#t=1283 (specifically, starting at time 21:38 if this link doesn't start you there). It sounds like you will need to just bump the depths around a bit, and it will drop those draw calls for you.

7
NGUI 3 Support / Re: (!!!) Improving NGUI: Voice your opinion
« on: November 19, 2013, 01:46:49 AM »
I would really like deprecation documentation (either inline, or links to external sites that could detail it). For example, in 2.7 and earlier, UITweener's 'onFinished' was a delegate. In 3.0, it is a List<Delegate>. So code that used to work with
  1. TweenPosition.Begin(gameObject, 1f, Vector3.zero).onFinished += MyOnFinishedHandler;
no longer works, and there is no documentation that appears to explain where it went, or what it should be changed to (yes, instructions are found in these forums if you know where to dig... having a nice link to them would be very helpful, though).
  1. // Deprecated functionality, see:
  2. //   http://www.tasharen.com/forum/index.php?topic=[something]
  3. // for instructions on new implementation
or
  1. // Functionality changed from 2.7.x to 3.x. To use this, you must ...

EDIT 1:
I didn't see that there were 3 pages of comments before I wrote that up, and it looks like my concerns were already shared and discussed:
Quote
I'm thinking of adding help buttons to components and linking them to posts here, where users can always ask questions related to the topic directly.
Oh well.

But, I would be happy to contribute time to expanding documentation, writing up simple tutorials for various components, etc. if that is a big task. I've always found things like user-committed tutorials to be the best part about forums, so don't mind contributing myself.

EDIT 2:
This is just a nitpick, but I notice that several files don't have any Copyright info, some do and go only from 2011-2012 and others from 2011-2013, many have different line endings (some LF, others CRLF), and encodings vary (ASCII, UTF-8, UTF-8 with BOM, ISO-8859, etc.).  :-X

8
NGUI 3 Support / Re: I could not find 2D
« on: October 14, 2013, 09:00:18 AM »
Click on the Layers button, then click the Edit Layers... at the bottom. You will be presented with a list of both layers and tags that have a bunch of empty slots. In those empty slots, add your own layer/tag names that you want to use. In this case, create a layer called 2D UI and 3D UI (or different names if you wish).

From that point on, you will always have those new layers/tags available for use both in code and in the Editor and NGUI.

http://docs.unity3d.com/Documentation/Components/Layers.html

9
NGUI 3 Support / Re: Two cameras at 50% each of width
« on: October 05, 2013, 07:38:04 PM »
Are the two cameras you're using being used only for your UI, or do they display something else (like parts of a scene)? Unless you want to finagle your z-depths around, I'd strongly suggest creating a dedicated camera (or cameras) for the UI elements so they can always be drawn on top of everything else.

Personally, I'd use a single camera for the UI and just place buttons on both the left and right side. Then those buttons would be batched to a single draw call (two draw calls if you use labels with fonts).

10
NGUI 3 Support / Re: nGUI scale problem
« on: October 05, 2013, 07:30:51 PM »
If you want absolute scaling, use UIStretch. Set its Relative Size to 0.1 (10%) and 0.05 (5%).
Otherwise, select the UI Root and change the ScalingStyle and see if PixelPerfect/FixedSize/FixedSizeOnMobile works best for you.

11
NGUI 3 Support / Re: A small detail...
« on: October 05, 2013, 07:27:25 PM »
I wouldn't be willing to pay anything for it. Seriously: the amount that it contributes to NGUI is minimal. It's eye candy that brings no functionality (other than ease of scrolling through a few lines of text). I don't use that feature of UILabel, since I always access its .text field and change the text dynamically.

I personally enjoy sharing my fixes and submitting bug reports so everyone else using NGUI can benefit.

12
NGUI 3 Support / Re: 2.7.0 resetting UIInput
« on: October 03, 2013, 09:20:45 AM »
What happens when you set the text to an empty value?
  1. inputLabel.text="";

13
With 300 prefabs to go through, you may find it more useful to keep with 2.7.x. However, there is a fix to this, if you have a few things in Unity enabled:
Edit->Project Settings->Editor should let you choose 'Version Control: Meta' and 'Asset Serialization Mode: Force Text'
Having meta files generates gives you the flexibility to see the internally-generated GUIDs. UIButton.cs and UIImageButton.cs both create a .meta file, and if you look at their respective UIButton.cs.meta and UIImageButton.cs.meta files, they have a GUID in the YAML file. You can search through all of your .prefab and .unity files for the old GUID value for UIButton/UIImageButton, and replace them with the GUID of these new ones, and it will fix the 'broken' links.
This is certainly not ideal, but it might be faster to do a massive search-and-replace through all your files than to manually reattach everything.
Is there a reason you need to upgrade your project at this stage of development, though? Does 3.x do anything that you need which 2.7.x doesn't fulfill for you?

14
You can modify the tween's .to value. When you do a TweenPosition.Begin(go, duration, newPosition), its '.from' value is the GameObject's current location and its '.to' value it the 'NewPosition' (it's all based off of its .localPosition, not world .position).

If you know the new location (basically, its .to position plus any new movement distance you add to it), I would just update the '.to' value:
  1. Vector3 currentPosition = myPositionTween.to;
  2. Vector3 deltaPosition = new Vector3(0f, 0, 100f); // Or whatever movement distance you want
  3. Vector3 updatedPosition = currentPosition + deltaPosition;
  4.  
  5. myPositionTween.to = updatedPosition;
  6.  

This will 'tack on' 100 pixels (along z) to the current position tween.

So if you have a counter that should fill to '100' and the player hits their button twice really quick, it will start to lerp to '200' and then just continue (without stuttering or restarting) straight to '300'.

Is that what you're looking for?

15
NGUI 3 Support / Re: NGUI 2.7.0: Add 'relativeSizeOffset' to UIStretch
« on: September 22, 2013, 05:59:50 PM »
So re-bumping this, but now (that 3.x is out) with a request that it can be added to NGUI 3.0. Ple-e-e-ease? (Each time I upgrade, I have to go back in and re-add the lines.)

It works amazingly well for stretchable windows (a couple screenshots attached to demonstrate). Everything uses the 'background' UISprite as their reference, using either UIStretch (with the pixel offset) for their scale or UIAnchor (which already has a pixel offset) for their position.

The only changes are:
  1.    /// <summary>
  2.    /// When Style is Both, Vertical, or Horizontal, make the scale relativeSize + this amount.
  3.    /// </summary>
  4.  
  5.    public Vector2 pixelSizeOffset = Vector2.zero;
  6.  
instead of relativeSizeOffset, per Nicki's suggestion, and 'localScale' is changed to simply 'size' to match the rest of the 3.0 changes:
  1.  
  2.                                 if (style == Style.Both || style == Style.Horizontal)
  3.                                 {
  4.                                         size.x = Mathf.Max(0f, (relativeSize.x * rectWidth) + pixelSizeOffset.x);
  5.                                 }
  6.                                 if (style == Style.Both || style == Style.Vertical)
  7.                                 {
  8.                                         size.y = Mathf.Max(0f, (relativeSize.y * rectHeight) + pixelSizeOffset.y);
  9.                                 }
  10.  

Pages: [1] 2 3 4