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

Pages: 1 [2] 3 4 ... 10
16
I assume it is being accessed from a different thread if the scene is scene id 0 (which unity streams the level load from what I understand). I was able to replicate this problem with the included examples. You need to turn off exception handling in the player settings and turn on the development build and build the scene as scene 0.

17
We upgraded our project to NGUI 3.7.4 and we started experiencing some problems with an exception that is being thrown when in development build.

Unhandled Exception: System.ArgumentException: PropertyToID can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.

We believe that the problem is that on line 636 of UIDrawCall you create the references via

  1.        
  2. static int[] ClipRange =
  3.         {
  4.                 Shader.PropertyToID("_ClipRange0"),
  5.                 Shader.PropertyToID("_ClipRange1"),
  6.                 Shader.PropertyToID("_ClipRange2"),
  7.                 Shader.PropertyToID("_ClipRange4"),
  8.         };
  9.  
  10. static int[] ClipArgs =
  11.         {
  12.                 Shader.PropertyToID("_ClipArgs0"),
  13.                 Shader.PropertyToID("_ClipArgs1"),
  14.                 Shader.PropertyToID("_ClipArgs2"),
  15.                 Shader.PropertyToID("_ClipArgs3"),
  16.         };
  17.  

I think these arrays be created in the Awake() if possible and not as an initializers.

We were able to reproduce the crash in a naked project. Import NGUI. Set player settings to be FAST & NO Exceptions. In the build settings check for "Development build" and build onto the device. When the scene starts to load this exception will be thrown and crash the app.
NGUI 3.7.4 (Downloaded and upgraded on September 29th)
Unity 4.5.4f1
XCode 6.0.1
Multiple devices running both iOS 7 and iOS 8 exhibited this behavior.

Let me know if you need additional information.

18
TNet 3 Support / Re: LAN Server Creation Problem IOS mainly
« on: September 12, 2014, 07:26:08 PM »
Yes, the adapter is always of type "Unknown" even when connected via cell data.

19
TNet 3 Support / Re: LAN Server Creation Problem IOS mainly
« on: September 05, 2014, 02:25:05 PM »
I'm not sure if you want to include this in the raw code base because I assume other users may want to be able to connect to remote game servers via a cell network (if it was hosted on Amazon for example). I would guess that the device needs a valid local IP to connect which would not be the case if that was the only active connection. We are only looking for LAN functionality currently, so it is not a problem for us to ignore the IP address of this NIC. I'm not sure if TNET needs a local IP to connect to an external server in this case.

20
TNet 3 Support / Re: LAN Server Creation Problem IOS mainly
« on: September 05, 2014, 10:29:04 AM »
To reiterate the problem, we're using the TNET sample menu included with the TNET package. On iOS with a device with both a WiFi and cell data network connection it will start up a server fine and will show up in the lobby list for all devices. However, when you try to connect to the server it starts using either itself or another device (that can see it in the lobby server) it will time out or not connect. This affects both iPhones and iPads have active cellular data networks when you use the cell data NIC. If you turn off the cell data network it will work fine, but asking users to do this in order to host a LAN game is not a desirable user experience. 

We tested the same thing on an Android phone with Cell Data active (and WiFi disabled) and it doesn't have a problem hosting through the cell network. This leads us to believe that it might be a Mono bug with the iOS implementation.

A co-worker of mine was able to spend a significant amount of time trying to track down a problem. We determined a workaround for this problem but not the underlying problem.

He created a test script:

  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Net.Sockets;
  4. using System.Net;
  5. using System.Threading;
  6.  
  7. public class TestScript : MonoBehaviour {
  8.  
  9.     private int kListenPort = 5129;
  10.     private TcpListener _listener;
  11.  
  12.     // Use this for initialization
  13.     void Start () {
  14.         StartCoroutine (CoroutineStartTest ());
  15.     }
  16.  
  17.     private IEnumerator CoroutineStartTest() {
  18.         StartServer ();
  19.         yield return new WaitForSeconds (1);
  20.         ClientConnect (new IPEndPoint(TNet.Tools.localAddress, kListenPort)); //LOCAL ADDRESS[0] IS CELL DATA
  21.         ClientConnect (new IPEndPoint(TNet.Tools.localAddresses[1], kListenPort)); //WILL WORK AS [1] IS WIFI
  22.     }
  23.  
  24.     private void StartServer() {
  25.         _listener = new TcpListener (IPAddress.Any, kListenPort);
  26.         Debug.Log ("Starting listener...");
  27.         _listener.Start(5);
  28.  
  29.         Thread thread = new Thread (ThreadFunc);
  30.         thread.Start ();
  31.     }
  32.  
  33.     private void ThreadFunc() {
  34.         Debug.Log ("Starting Thread function...");
  35.         Socket socketConnect = null;
  36.         while (true) {
  37.             if (_listener.Pending()) {
  38.                 socketConnect =    _listener.AcceptSocket();
  39.                 Debug.Log ("Socket Connection established: " + socketConnect.LocalEndPoint);
  40.             }
  41.         }
  42.     }
  43.  
  44.     private void ClientConnect(IPEndPoint endPoint) {
  45.         if (endPoint != null) {
  46.             string error = "(None)";
  47.             try {
  48.                 Debug.Log("Creating client socket...");
  49.                 Socket socket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
  50.                 Debug.Log("Connecting at " + endPoint + "...");
  51.                 socket.Connect (endPoint);
  52.             } catch (System.Exception ex) {
  53.                 error = ex.Message;
  54.             } finally {
  55.                 Debug.Log("Finished Connect. Error: " + error);
  56.             }
  57.         }
  58.     }
  59. }
  60.  

It seems that there might be a iOS mono bug with connecting to a cell data's IP address, that goes into unmanaged code and becomes very difficult to track down.

The workaround that he came up with is the network interface type will return UNKNOWN for cell data, and we ignore all network interfaces with UNKNOWN so that we can make sure that we don't include the cell data IP in the list of local addresses. So to work around this problem we put this code into the TNTools.localAddresses property.

  1.  
  2. for (int i = 0; i < list.size; ++i)
  3. {
   
  4.        NetworkInterface ni = list[i];
  5. 
     if (ni == null) continue;
  6.         IPInterfaceProperties props = ni.GetIPProperties();
  7.         if (props == null) continue;
  8.         if(ni.NetworkInterfaceType == NetworkInterfaceType.Unknown) {
  9. 
             continue;
  10. 
     }
  11.         ….
  12. }
  13.  

This will prevent the local addresses from using the cell data network and require WIFI to prevent this from happening.

Curiously, the iPad with cellular that we tested exhibited the same problem, but the order of the network interfaces was different so that it put the WiFi network adapter in index 0 which works fine. However, to be clear, the iPad would exhibit the same connection problems if we disabled the WiFi and it was forced to use the cell data's IP.

Please let me know if you have any further questions or if you need additional clarification.

21
TNet 3 Support / Re: LAN Server Creation Problem IOS mainly
« on: August 08, 2014, 01:19:09 PM »
Just to clarify.

On both my iPhone5 and my co-worker's iPhone5c (and I assume other iPhones with active data plans) we can't connect to a hosted server on our devices unless we first disable the cell data option inside of the Settings App. We can host a server initially just fine. The server will show up in the Editor and other devices known servers list via the UDPLobbyClient. So Application.internetReachability shouldn't be a problem since it sends the information over the network. However, nothing can connect to the server, not even the iPhone where the server was hosted. It will either time out or produce the error "Unable to connect" and sometimes I receive "The object was used after being disposed". 

The LAN and WAN IP address that is being produced in the sample project is coming from the WiFi Router as confirmed from WhatIsMyIp.com on a desktop computer on the same Wifi network.

We don't have a cell data network 3G/LTE iPad to test on (we only use WiFi iPads in our testing so far), so it might be happening on iPads with multiple NICs as well.

I'm using the default TNET sample projects in Unity iOS Pro 4.5.2.

I have tried to do this with and without XCode connected and it is producing the same results.

We haven't done any Android tests yet, so we can't comment if this problem is present on Android phones.

I wouldn't be surprised if this was a Unity iOS Mono bug, but I don't really know way to test it with a newer version.

22
TNet 3 Support / Re: (1.9.6b) iOS Freeze/Crash on Sleep
« on: August 07, 2014, 12:59:02 PM »
TNUdpLobbyClient will crash during its Update() when it is trying to send on a socket that is probably already closed (line 126).

We ended up doing something very similar to what you had documented, but instead of directly calling OnEnable/Disable we set the script enabled or disabled directly by using .enabled.

Are there any recommendations on how best we can terminate the server during the pause. Do you see any problems with killed the server once the app is resumed?

23
TNet 3 Support / Re: LAN Server Creation Problem IOS mainly
« on: August 07, 2014, 10:43:56 AM »
@ArenMook - Yes, it is only iPhones that are having this problem. We don't have an iPad with a cell data plan (WiFi only) so it might be a problem there as well. It is similar in that it will take awhile trying to connect and then produce the error "Unable to connect". However, I'm not use "Good Olde Sockets" I'm using Unity iOS pro and using the basic TNET sample. I turned off my phone's cellular data in Settings and it worked. However, expecting our users to turn off their cell data before hosting a game isn't going to be something that is going to work very well. Are there any other solutions or recommendations you can provide for this problem?

24
TNet 3 Support / Re: (1.9.6b) iOS Freeze/Crash on Sleep
« on: August 06, 2014, 12:48:33 PM »
So we did some digging into this problem, and I'd like to see a future version of TNET potentially resolve these problems internally.

One problem was that the TNUDPLobbyClient was crashing during its update when we would pause/resume. So basically we need to be able to turn it off (enabled = false) when the application goes to sleep. I think this might be considering doing automatically. Just be aware that the system should keep a remembered value for its enabled state so that it doesn't turn on if it was previously turned off.

The second problem was a little less clear cut. The problem has to do with what is the correct process to shutdown the server when we go to pause. The best solution I came up with is waiting until we resume the application before disconnecting and stopping the server. I assume it has something to do with the timing async nature of networking that the server needs more time to shutdown than Application pause gives it.

Another thing is that debugging the app through XCode produces a lot of errors and exceptions that doesn't seem to stop the app if XCode is disconnected.

However, I'd be curious to hear any other solutions that may be better from your perspective?

25
TNet 3 Support / (1.9.6b) iOS Freeze/Crash on Sleep
« on: August 05, 2014, 06:52:33 PM »
We're running into a problem when we put our devices to sleep the device will be unresponsive when we awake. We did a test on the examples and it is happening there as well. We're only targeting iOS and Editor right now in a LAN-only connection environment.

We deploy the example on an iOS device, and we connect to a server fine. However, as soon as the app is put to sleep the app becomes unresponsive. We haven't spent a lot of time digging into the problem but it seems to affect all of our iOS devices (various iPads and iPhones) so I figure you'd be able to replicate the problem fairly easily.

Connect to a server, launch and example, do some network sends, put the device to sleep (tapping the wake/sleep button), give it 5 seconds, and then rewake the device by tapping the wake/sleep again. The Connect dialog will appear, but the app will not pull up the server list nor is the other UI is not responsible. We've tried it on our project (which uses NGUI) and the same problem happens there in our lobby browser.

We'll continue to do more digging and update this topic with more information when we can get it to you. In the meantime, could you try to look into this problem and see if it is happening on your hardware? I looked through the docs, but I didn't see a best practice in regards to how we need to close sockets or handle the sleep functionality so that the app doesn't freeze.

We've tried with multicasting on and off, and it doesn't seem to affect the problem.

Thanks!

26
TNet 3 Support / Re: LAN Server Creation Problem IOS mainly
« on: August 05, 2014, 06:43:21 PM »
Hmm, I think I might be having a similar problem or it is related. I tried turning off multicasting and still having a problem. I also have similar requirements in my project (1v1 LAN).

To replicate:
Using the example scenes in a fresh Unity 4.5.2 project I deployed to my iPhone5 (7.1.2). I created a new project from the sample scene (set Example Menu) as the 0 ID. Deployed on my iPhone. It loads and launches fine. I can create a server on my iPhone and it shows up on the server list but I'm unable to connect either on the phone itself or from an editor client. It works fine from an iPad, but my iPhone is having problems.

Can you replicate this problem ArenMook when you get a chance?

27
You can't access it right away, you need to wait for a network packet to go through which is asynchronous. If you need to set the name when the object is created, look at the sticky for RCCs as that worked for us. (except that in the RCC the TNObject uid hasn't been assigned yet)

http://www.tasharen.com/forum/index.php?topic=5416.0

28
TNet 3 Support / TNObject where rebuildMethodList = false?
« on: August 01, 2014, 11:33:54 AM »
Hey Aren,

We recently started using TNET for adding multiplayer to our product crazy late in the dev process. Amazingly, the process has been pretty good. Which I attribute to the quality of the TNET plugin.

We're concerned with the overhead of rebuilding the RFC method list (mainly since it checks public/private/instance methods on the game object). The main reason we want a TNObject on our objects was because we wanted a network synced UID that we could use to find units on each of the end-users's machine.

So to confirm our understanding of how this works, unless the object receives an RFC that it manages, the method list isn't recomputed for the entire hierarchy? If we add a TNObject with a 0 UID to the unit's GameObject that we sync with a TNManager.Create, it would only rebuild the method list if that unit received an RFC call, right? In our case, there aren't any RFCs on the unit (since the UID is the only thing we care about) so the method list shouldn't be rebuilt?

If it does execute the rebuild method, is there a way you can recommend that we create a TNObject with a rebuildMethodList = false so that we can make sure we don't spend the reflection time to find all of the RFC calls?

Thanks!

29
NGUI 3 Support / Re: 3.6.6 Broke layout
« on: July 02, 2014, 12:42:49 PM »
That's exactly what UIWidget does.

Thank you for letting me know about that component. I figured it was only supposed to be used internally for inheritance.  :-[  I'll start the process of updating my GUI to the anchoring system and see if I run into any other problems.

Thanks again.

30
NGUI 3 Support / Re: 3.6.6 Broke layout
« on: July 02, 2014, 12:15:24 PM »
I upgraded to 3.6.6 and it was completely borked as well. I'll try to go through and try to update all of my UIAnchors to the new anchoring system.

I think the most important thing about the old UIAnchor system was that it could be used for any game object in addition to UIWidgets. Now I have to create a 90% transparent sprite or other UIWidget in order to get some of my UI anchored correctly. This is not always desirable depending on the organization structure of your UI hierarchy. I have a lot of empty controller objects that are parents to a lot of internal sprites/textures/labels and putting a texture or other widget at the top can create some undesired color tinting mechanics. I wish there was a way to include an "empty" UIRect that we could use to anchor widgets.

Pages: 1 [2] 3 4 ... 10