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

Pages: 1 ... 5 6 [7] 8
91
I have just started learning TNet and I'm encountering a strange issue with TNAutoJoin that was used in the second TNet tutorial and in an example scene. Any attempt to start the game is interrupted by the following error:

  1. Exception has been thrown by the target of an invocation. (TNAutoJoin.OnNetworkConnect)
  2. UnityEngine.Debug:LogError(Object, Object)
  3. TNet.UnityTools:Broadcast(String, Object[]) (at Assets/TNet/Client/TNUnityTools.cs:216)
  4. TNManager:OnConnect(Boolean, String) (at Assets/TNet/Client/TNManager.cs:977)
  5. TNet.GameClient:ProcessPacket(Buffer, IPEndPoint) (at Assets/TNet/Client/TNGameClient.cs:665)
  6. TNet.GameClient:ProcessPackets() (at Assets/TNet/Client/TNGameClient.cs:633)
  7. TNManager:Update() (at Assets/TNet/Client/TNManager.cs:962)

The server logs the connection, though. I've tried checking a few options like changing IP and ports of the server in the server config and TNAutoJoin inspector, but those parameters don't seem to be related to the issue. What else could be happening and is there a way to make the "Exception has been thrown by the target of an invocation." error more informative? (I've seen lots of very varied cases on the net mentioning it, none applying to the situation as far as I see, so it might be a generic error covering very broad amount of potential reasons)

Update: Rechecked it on an empty project, the error is not happening, so it's most likely down to differences in TNAutoJoin public parameters I was attempting to use. The question about making "Exception" error more informative still stands though, as I'm pretty much in the blind about the cause.

Update2: Reimporting TNet somehow fixed the issue, examples now open even in the current project. Not sure if issue is related or not, but I'm now getting a strange error in the server log that doesn't seem to affect the connection:

  1. 127.0.0.1:3806 has connected
  2. The requested address is not valid in its context.
  3.  

This happens on every single connection I make with the server and a client situated on the same PC.

92
bac9, you inspired me to do some heavier digging, I found this out of the box solution. http://www.ana-todor.ro/blur-shader-for-unity3d/08/01/2013/

It's not perfect, but it's damn close, and super easy, and free, and relatively light on the processor. Give it a whirl.

Thankyou for your problem, for in expressing yours, you have inspired my solution, hope it works for you as well.

Thanks. I have modified the shader to use NGUI-controlled vertex colors as inputs (dropped color support, left R as brightness, used G for blur radius and B for lerping between standard sprite rendering and blur overlay rendering), named GrabPass texture to reduce performance hit from multiple elements using the shader at once and did some other tweaks, and it works pretty great for me. Nowhere close to iOS blur quality, unfortunately (they have insane radius and smoothness, that can't be achieved with 12 or 16 samples register limit allows), but it's passable enough.

93
NGUI 3 Support / Color tint support for custom shaders
« on: June 10, 2014, 09:21:41 AM »
Can someone point me to proper way of exposing shader tint color to NGUI? Every single shader shipping with NGUI has no such property, yet somehow every texture and every sprite still supports tinting. How is it achieved? I'm mostly interested in that to get UITexture elements with custom shaders working with NGUI inspector tinting, as creating materials and dragging them into UITexture material slot every time you need to update a color isn't the most convenient workflow.

I tried few widespread naming conventions like _Color and _Tint, but NGUI seems not to search for properties named like that. What is it using then?

94
Phew, I think I tracked it down to RealTime.time being imprecise and allowing for intervals equal to 0 to be calculated, which resulted in a division by 0 in one method and killed a bunch of stuff in the process. Looks like I'll have to clamp every use case of (RealTime.time - lastTime) to some low value.

Still unsure why it killed UIPanels, but still, good to see the issue wasn't originating from NGUI.

95



Implemented a little display that tracks relevant UIPanel and GameObject state on disappearing objects and added the console, hopefully that will provide at least a hint on what's happening.
In the meantime, any advice on catching the issue through other means, recollections of similar issues encountered, or other help would be appreciated.

96
I'm encountering a very weird issue and I'm not sure where to start digging for reasons behind it. Any help would be appreciated. In short, what's happening is this: some of the panels in my application (it's a relatively simple 2D game built entirely with NGUI panels) disappear during prolonged play with no clear trigger or reason. Here is how one of the screens looks normally:



And here is how it looks once the glitch happens:



Unfortunately, over the course of the week in testing, I was only able to encounter the issue on iOS and Android devices and never in the editor, which severely complicates things as I'm unable to inspect the state of missing objects to figure out how they do it. My versions so far:

- Something is changing the depth of an UIPanel, hiding them behind the background (proved that unlikely by checking the glitch with a build with a transparent background - nothing was there)
- Something is changing the alpha of an UIPanel to 0, making it invisible
- Something is disabling or destroying a GameObject housing a UIPanel (might be likely, as one of the managers hangs if the glitch happens during interaction with one of the plants, indicating possible NRE)
- Something is moving an UIPanel GameObject out of view
- Some internal issue corrupts the UIPanel composite texture, making it invisible

As I've said, though, it's very hard to know what exactly happens when I'm unable to reproduce the issue in the Editor or during on-device tests with XCode tethering. Only things I know so far are:

- That the glitch usually happens more than half an hour into non-stop gameplay
- That the glitch affects only certain elements of UI in a very stable manner, absolutely never affecting the background panel, upper menu panel and main menu panel
- That the glitch happens all at once and never gradually

Another problem is that I'm absolutely sure that I don't have a single line in my project code that can control UIPanel depth and alpha, and I don't have a single line moving or destroying the GameObjects that are disappearing. Yet they somehow do disappear.

How can I approach debugging this? I have implemented an ingame debug console, but obviously, I can't just dump the state of every disappearing UIPanel/GameObject on every Update() and hope to get a readable log after it. Is there a cleaner method? For example, a way to hook a debug message to every alpha change, depth change and other change happening with UIPanel properties (if those have getters/setters and aren't just public).

97
Yup, that's the one. If it looks like that for you then you have shaders disabled, or are using Unity Free.

Not sure what you mean by "shaders disabled" and nope, I'm using Unity Pro.
As I said, I'm under impression something was broken by Unity 4.5 because I recall this example looking different, with lighting and transparency properly displayed on the UI. Reimporting the project to 4.3 right now to check if that's the case.

Update: Nope, seems to look the same in 4.3. Something was changed in the shader or scene then.

98
BeShifty, thanks for the advice!

If you look at the sci-fi UI atlas example you will notice that it is see-through, and it happens to distort the colors of the background (check out the draggable window example). This is done by sampling the existing color buffer and warping it using the shader. You would do something very similar. Simply create a UITexture and give it a shader that will sample the existing screen buffer and will simply blur the result. It's not NGUI-specific at all here -- just a regular Unity shader.

Sci-fi atlas is using standard Unlit/Transparent Colored shader, so there is no distortion to speak of. If you're talking about the Refractive shader, then I don't think it works anymore, for some reason. Maybe Unity 4.5 broke something? I don't remember it looking like that half a year ago.

99
I'm wondering if there is a good way to achieve the effect depicted below without resorting to huge atlases with manually blurred screenshots. I know iOS/OSX do the effect by applying real blur to their render textures - maybe there is a way to alter UIPanel code and NGUI shaders to achieve the same thing? Like allowing a UIPanel to contain a blur value that is used by a shader to blur the texture.


100
I'm making a stylized pseudo-3d UI using fisheye non-orthographic camera. Here is a simple gif:



My approach to it is pretty simple - I keep a traditional orthographic camera on while editing, and it's replaced by another camera with all those distortions as the game starts, so I'm spared from dealing with alignment issues and weird distortions while designing the UI content. Still, are there any potential problems that can arise from that setup I should be aware of? Like, for instance, would raycasting continue to work correctly in all cases there?

101
NGUI 3 Support / Is there a way to use anchors to rotate an object?
« on: March 26, 2014, 05:18:40 AM »
I'm wondering if it's possible to use NGUI anchor system not just for horizontal/vertical alignment of elements but also to rotate something. Let's say I have a rectangle-based line with 4px Y size (height) and variable X size (length) that I want to always have attached to a corner of one object and stretched to a corner of another object, even if those corners are not horizontally aligned.

I would guess it's not possible using only the anchors and I'm better off just writing a bit of custom code doing the rotation and X scaling? Something similar to widespread "look at" implementations, with me leaving anchors to handle just the origin point of that line and nothing else, I guess?

102
NGUI 3 Support / Re: Please add newline support for CSV
« on: March 07, 2014, 04:09:43 AM »
As far as I understand it will be added in the next release, but thanks anyway! : )

103
NGUI 3 Support / Re: Question about the NGUI license
« on: March 05, 2014, 05:26:25 AM »
Assuming you're asking about that, NGUI has no hardware/system based authentication so you will be able to work with it normally no matter the change.
However, the license for Unity itself is indeed attached to your PC, so I'd recommend reading up on deactivating it before you change the system.

Once you set up Unity on the new PC, all that would be necessary is to enter the Asset Store from your properly activated Editor and reimport the NGUI package from there (or just to reopen your project).

104
NGUI 3 Support / Adding new line support to the localization script
« on: March 04, 2014, 04:16:51 AM »
It's probably relatively simple to implement, but I'm not sure how to. I have hundreds of long multi-line strings in my project, and putting localization files together was a bit of a pain with the way language file syntax works at the moment. As an example, I'd like to do away with this:

  1. L1.Scene1.Window1.Label1, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. \n\nDonec faucibus nisl a orci pulvinar laoreet. Pellentesque eu condimentum dui. Nunc quis justo tortor. Fusce quis massa ut enim pellentesque semper vitae eget elit. Phasellus ut turpis egestas augue tempor laoreet.\n\nPraesent suscipit commodo ligula eu dignissim. Morbi at arcu eu quam ornare vehicula. Duis mollis sem in lorem fringilla, porta lobortis justo suscipit. Vivamus venenatis ullamcorper diam quis mattis.\n\nAliquam ante dolor, ultrices et vestibulum vel, dignissim ut magna. Donec tempus lacus at sapien fermentum fermentum. Morbi convallis eleifend arcu, vel imperdiet libero varius aliquet. Aenean justo metus, dignissim nec nisl vitae, lobortis vulputate sapien. Donec quis tortor sit amet tortor pulvinar lacinia. Vivamus interdum massa ut venenatis facilisis. Morbi lacinia fermentum ipsum, at ornare massa posuere ac. Duis tempus mi nec leo semper vulputate. In fermentum ac lacus vel interdum. Pellentesque et hendrerit nulla. Sed tristique dignissim hendrerit. Praesent id rhoncus nibh. Nunc nec egestas nisi. Morbi et tincidunt magna. Nam ut velit nec ligula feugiat ultrices.\n\nPraesent lacinia vestibulum nulla vitae mollis. Aenean dolor lectus, porttitor quis rutrum eu, scelerisque non augue. Donec in nunc eros. Morbi adipiscing vitae felis condimentum pellentesque."

And use something like this in my files:

  1. L1.Scene1.Window1.Label1 =
  2. "Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  3.  
  4. Donec faucibus nisl a orci pulvinar laoreet. Pellentesque eu condimentum dui. Nunc quis justo tortor. Fusce quis massa ut enim pellentesque semper vitae eget elit. Phasellus ut turpis egestas augue tempor laoreet.
  5.  
  6. Praesent suscipit commodo ligula eu dignissim. Morbi at arcu eu quam ornare vehicula. Duis mollis sem in lorem fringilla, porta lobortis justo suscipit. Vivamus venenatis ullamcorper diam quis mattis.
  7.  
  8. Aliquam ante dolor, ultrices et vestibulum vel, dignissim ut magna. Donec tempus lacus at sapien fermentum fermentum. Morbi convallis eleifend arcu, vel imperdiet libero varius aliquet. Aenean justo metus, dignissim nec nisl vitae, lobortis vulputate sapien. Donec quis tortor sit amet tortor pulvinar lacinia. Vivamus interdum massa ut venenatis facilisis. Morbi lacinia fermentum ipsum, at ornare massa posuere ac. Duis tempus mi nec leo semper vulputate. In fermentum ac lacus vel interdum. Pellentesque et hendrerit nulla. Sed tristique dignissim hendrerit. Praesent id rhoncus nibh. Nunc nec egestas nisi. Morbi et tincidunt magna. Nam ut velit nec ligula feugiat ultrices.
  9.  
  10. Praesent lacinia vestibulum nulla vitae mollis. Aenean dolor lectus, porttitor quis rutrum eu, scelerisque non augue. Donec in nunc eros. Morbi adipiscing vitae felis condimentum pellentesque."

At the moment the parser expects every single new line to begin with a key name, which renders this impossible. Obviously it would be nicer to somehow change that so that it will e.g. recognize only the contents of the lines starting without " and ending with = as valid key names, and all the rest inside the following "..." blocks as assigned values. Particular syntax doesn't matter, though, I'll be more than happy with something like that too:

  1. <key name="KeyName1">
  2. <value>TextLine1InEnglish
  3. TextLine2InEnglish
  4.  
  5. TextLine3InEnglish
  6. TextLine4InEnglish</value>
  7. <value>TextLine1InGerman
  8. TextLine2InGerman
  9.  
  10. TextLine3InGerman
  11. TextLine4InGerman</value>
  12. </key>

Or with any other setup that makes sense and allows you to use new lines freely. How should I go about modifying Localization.cs and ByteReader.cs to achieve that?
Most likely I need to change how ReadCSV() in the ByteReader works.

105
Hi! I've encountered a bit complicated task and would like your opinion on how should I best approach implementing it.



I'm making an measurement screen where you can drag and drop several elements around while a sprite under them gets resized as sort of a bounding box, with two side clones following it's width and height and displaying the size of said sprite. Think of it as a room. You drag the furniture around, trying to arrange it into the most optimized square possible.

I'm a bit stalled on figuring out how to handle the resizing of that sprite best. What I'll attempt to do right now is:

1. Set all objects and a room to the bottom left origin mode to simplify the work (so that stuff like pos.x - width/2 won't be necessary);
2. To determine the X position of a room, loop through all objects and find one with the smallest X position, use it.
3. To determine the Y position of a room, loop through all objects and find one with the smallest Y position, use it.
4. To determine the X size of a room, loop through all objects and find one with the biggest sum of the X position and width, use it.
4. To determine the Y size of a room, loop through all object and find one with the biggest sum of the Y position and height, use it.
5. Force those new values into the NGUI sprite of a room.
6. Resize the X/Y "shadows" of a room accordingly.
7. Update the labels from the room sprite size values.

Is that a good way of achieving the functionality, or there is a faster or easier one? For instance, I'm not very familiar with NGUI table functionality, only ever using them for simple horizonal and vertical scrolling lists. Is it possible to repurpose the table for something like that, seeing that it already has some of the similar functionality (checking children positions/size, resizing itself, etc)?

Pages: 1 ... 5 6 [7] 8