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

Pages: 1 [2]
16
NGUI 3 Support / Problems cleaning up _RealTime
« on: January 03, 2014, 05:07:39 PM »
Hi,

looks like I am using NGUI wrong some bugs were introduced in recent versions of NGUI. I am not sure, but it seems it started with v3.0.x. I until recently had 3.0.6 f5, just updated to 3.0.8 f4 and the problem remains. In 3.0.x < 3.0.6 this problem did not exist. I can't give you some conclusive theory on what happens, only a few hints.

Again, I am not 100% sure, but it seems the problem started when I started using UIStretch to stretch a screen fader GameObject (a fader covering the screen for a fade in/out effect). The effect works fine now and without errors in v3.0.x y 3.0.6, but on the console I now often get an error a la:

  1. UnassignedReferenceError: Variable mTrans of UIStretch is not assigned.

The variable UICamera of the UIStretch component is assigned (the Unity3D standard camera), the container variable is not. Is has worked fine until recently. I assume because of this, the console also says things like:

  1. Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)

(I don't use OnDestroy anywhere in my own code) and the infamous:

  1. !IsPlayingOrAllowExecuteInEditMode ()

As a result, the _RealTime object remains in the scene and accumulates on Play tests (i.e. five _RealTime objects in the scene after five Play tests). This (again, I assume) is responsible for errors I get when I deactivate a button OnClick that has a hover effect that changes the button color.

EDIT:
I get the IsPlayingOrAllowExecuteInEditMode error by simply extending the UIPanel component in the inspector of any GameObject, if the _RealTime object remains in the scene.

Interestingly, NGUI also sometimes keeps the fader GameObject activated after a Play test, where it is always deactivated by default. This does not always happen, but often enough so that a manual deactivation on my part becomes frustrating. The fader has a TweenAlpha component, which interestingly sometimes gets a OnFinished Event assigned automatically (which happens nowhere else in my scene, though I use a lot of TweenAlphas).

I am relatively sure NGUI is to blame for all this since it did work with v3.0.x < v.3.0.6.

EDIT:
Scratch that. It seems the UIButtonColor error:

  1. NullReferenceException: Object reference not set to an instance of an object
  2. UIButtonColor.OnPress (Boolean isPressed) (at Assets/NGUI/Scripts/Interaction/UIButtonColor.cs:152)
  3. UIButton.OnPress (Boolean isPressed) (at Assets/NGUI/Scripts/Interaction/UIButton.cs:90)
  4. UnityEngine.Component:SendMessage(String, Object, SendMessageOptions)
  5. UIKeyBinding:Update() (at Assets/NGUI/Scripts/Interaction/UIKeyBinding.cs:112)

is something else. I have buttons in my scene that are activated either via mouse click or via a key press (UIKeyBinding component). When I click the button, I get no errors. When I use the key press, I do get the above error. The way my buttons work is that they deactivate themselves (actually their parent, which holds all that kind of buttons) when being pressed to avoid multiple presses. This kind of setup has worked probably since I use NGUI, it started throwing errors just recently. This behavior happens no matter how many _RealTime objects there are in the scene.

17
NGUI 3 Support / Could I upgrade from 2.6.5 to 3.0.6?
« on: November 25, 2013, 02:03:00 PM »
Hi,

I am still using 2.6.5 and now that I am doing GUI-work in my project I thought it might be the time to adopt NGUI 3.0.6. Could I migrate from 2.6.5 or should I update to 2.7.x first?

18
NGUI 3 Support / Atlas maker: Add/Update does nothing (anymore)
« on: September 05, 2013, 05:41:44 PM »
I just upgraded my NGUI version (and restarted Unity).

Now I want to create a new Atlas. I do so, selecting some textures when creating it. However, they don't show up in the list. Create the atlas by hitting the button. Select textures in the folder. The green Add/Update button shows up. Clicking it does nothing. "Texture" button is dark grey and says N/A. There's no error message on the Console. Restarting Unity or saving the scene does nothing.

Is this a new bug or did I forget how to create new Atlases properly?

19
NGUI 3 Support / Using NGUIs SetActive triggers Tweens only once
« on: August 12, 2013, 12:58:25 PM »
Hi,

yeah, the topic title almost says it all. I've got a NGUI UIPanel, with three Tweens on it for a transition effect: Alpha, Scale and Transform. I bring the Panel in via a keystroke and SetActive. That works fine once, the Panel transitions in and out and then the Panel is disabled as it should. Hitting the key again will re-enable the Panel (via SetActive, as before), but the Tweens wont start. The panel becomes visible as it was left: at the top of the screen, small and only 10% visible; as it is at the beginning of the transition. The UI however is there. The hardly visible buttons are clickable, the key commands set with NGUI work too.

So, does all this sound familiar to anybody?

What puzzles me is that somewhere else in my game I use the same setups. The difference being that there I don't use SetActive, but only clicked buttons to start transitions.

20
NGUI 3 Support / Combining NGUI and Unity's LineRenderer
« on: July 28, 2013, 03:27:23 PM »
Hi,

for my game I need a map where the player build routes via clicking on star systems. Now, those star systems need to be connected via lines. NGUI doesn't have such feature, which is why I am using Unity's LineRenderer.

My problem is that the lines in my current test case show up in the editor, but not in the game preview. See this screenshot:



In the middle column you can see many GameObject, all parented to a scroll view (which clipping does not work, btw). The three lines you can see (LineDrawer0, 1, 2) all have different Z values that I manually set for testing, with 0 (the selected line) giving me the look I want. The lines show up in the top left preview, but not in the buttom left game.

Do do I get those lines to show up in the game?

Now, you might say, well, set those lines up manully, using only NGUI. Well, I could do that. But it was already a pain setting up those buttons. Setting up the lines would be even more manual work, which I am currently doing via script:

  1. void Start () {
  2.                
  3.                 foreach ( Transform nextTf in MapNeighbors ) {
  4.                        
  5.                         createLine ( tf.position, nextTf.position, 0.025f, new Color ( 0.5f, 0.5f, 0.5f, 1.0f ) );
  6.                 }
  7.                
  8.                 foreach ( Transform lineChild in tf ) {
  9.                         Vector3 oldPos = lineChild.position;
  10.                         oldPos.z = 0;
  11.                         lineChild.position = oldPos;
  12.                         Debug.Log( lineChild.name );
  13.                 //      lineChild.Translate ( new Vector3 ( 0,0, -3 / lineChild.localScale.z ) );
  14.                 }
  15.         }
  16.  
  17. public void createLine (Vector3 start, Vector3 end, float lineSize, Color c) {
  18.                
  19.                 GameObject lineDrawer = new GameObject(string.Format("lineDrawer{0}", lineIndex));
  20.                 lineDrawer.layer = 9;
  21.                 lineDrawer.transform.parent = tf;
  22.                
  23.                 LineRenderer line = (LineRenderer) lineDrawer.AddComponent<LineRenderer>();
  24.                 line.material = mat; // new Material(shader);
  25.                 line.material.color = c;
  26.                 line.useWorldSpace = false;
  27.                 line.SetWidth(lineSize, lineSize);
  28.                 line.SetVertexCount(2);
  29.                 line.SetPosition(0, new Vector3( start.x, start.y, 0) );
  30.                 line.SetPosition(1, new Vector3( end.x, end.y, 0) );
  31.                
  32.                 lineIndex++;
  33.         }
  34.  

And if I did it via NGUI ... how would I go about it? Use a NGUI Sprite for each line? Let's say a 64x64 px line graphic, turned and scaled for each line? That would take forever to setup.

Also not that my map needs some dynamic element, it is not static. To build routes, the player would click planets to build a route. On top of the current thin grey lines a thick, green line would appear. I am not sure how I would do that via NGUI, but I do know how to do it with LineRenderer.

Also note that the clipping does not work. It's a scroll panel right now. I will now go and look at the scroll camera technique.

Thx

21
NGUI 3 Support / UI Scaling problem
« on: July 14, 2013, 01:33:16 PM »
Hi,

I just ran into a problem in my game using NGUI. I have a GUI with a 2D UI Root with Ortho Camera, while my game camera is Perspective. The setting on the UI Root is PixelPerfect.

Let's say my UI element is 240x200. On my 1920x1200 monitor it shows up fine (w/ PixelPerfect). On my 1400x900 notebook the UI elements stay that size (which I guess is the supposed behavior), so no the game is unplayable thanks to overlapping UI elements.

So on both computers I tried changing PixelPerfect to FixedSize. Now, all elements on my 1920x1200 monitor are larger, like maybe 2x as large. Question: Do I now have to go through all my GUI elements (and that's a lot!) and scale them down? Question: Shouldn't PixelPerfect and FixedSize look the same on my 1920x1200 reference monitor?

Just in case it matters: Manual Height: 720, Minimum Height: 320, Maximum Height: 1536.

Thx

22
NGUI 3 Support / Pixel sizes for content creation
« on: June 09, 2013, 10:17:40 PM »
Hi,

just one simple question: what pixel sizes am I supposed to make NGUI-related assets in?

Let's say I've got an asset that I want to be 240x240 px on my 1920x1200 px screen? Will I now make the asset 240x240 px or should I go for a 16-fold resolution, like 256x256 px?

Thx

23
The selection graphic is drawn before a selection is even made, causing the selection background graphic to be drawn in a impossible position.

Once you hover a selestable item in the list, the graphic snaps to the right position.

Or is it me?

24
Hi,

I just bought TNet and I wonder how to structure my project (on a macro level). I'd like to structure my code in a way that allows game play modes similar to Diablo II: a off-line mode with local save game files + local split-screen multiplayer (two players on the same keyboard) + local LAN multi-player aka. Open BattleNet. A online mode with save game files on a remote server, leaderboards + (nice-to-have) online multi-player where people can use the online save files aka. Closed BattleNet.

Now, how does TNet fit in? Obviously, I'd like to re-use as much code and assets as I can. In my game I got the usual stuff: space ships, planets, projectiles, particles etc.

Do I need two variants of my assets? One for local stuff (without anything TNet-related) and one for everything else? Or do I need three (offline, local multiplayer, internet multiplayer)? Or do I need only one variant? Where let's say a spaceship is full of components which I SetActive(true/false) on behalf?

Yeah I know it's hard to discuss high-level stuff on a forum. I bought the Space Game Starter Kit because I thought it would be an answer to my questions, but it seems the scope of the SGSK is a lot smaller.

25
NGUI 3 Support / Trying to understand menu swap
« on: June 02, 2013, 10:18:20 PM »
Hi,
I am studying the NGUI examples and have a bit of trouble understanding them. In the Main Menu example and the interaction example you're are both swapping out content, i.e. moving them around. In the Main Menu you use animation, in Interaction a tween. I understand that part, but I don't see how you activate them from the Outside.

There's no script saying
  1. OnActivation
  2. this.GetTween().Start()

or

  1. OnClick
  2. target.GetAnimation("Name").StartOnce()

Know what I mean? How do you start them from the outside? Must happen somewhere in the Inspector, so I'm kinda frustrated I don't see it :(

Pages: 1 [2]