Search Unity

Apple recently announced that beginning June 1, 2016, “all apps submitted to the App Store must support IPv6-only networking.” Since many of our users publish Unity games to the App Store, we wanted to take a moment to discuss Unity’s support for IPv6-only networks. Note that this requirement applies to both new app submissions and updates to existing apps.

What is IPv6?

From the Wikipedia article: “Internet Protocol version 6 (IPv6) is the most recent version of the Internet Protocol (IP), the communications protocol that provides an identification and location system for computers on networks and routes traffic across the Internet.” Devices can operate on an IPv4-only network (the previous standard), and IPv6-only network, or a network with both protocols in use. Apple’s new requirement means that apps must be able to operate in an IPv6-only network.

It is important to understand that IPv4 and IPv6 networks do not interoperate, although it is possible to pass traffic from one type of network over the other with tunnelling.

Does Unity support IPv6?

Yes! WWW and UnityWebRequest are IPv6 compatible on iOS out of the box because they are based on high level Apple networking APIs. And over the past few months we have been working to bring support for IPv6-only networks to Unity’s .NET/IL2CPP libraries. Our last known IPv6 bugs related to .NET/IL2CPP were corrected in the 5.3.4p4 patch release. There is one fix pending for UNET which is going to be shipped in coming weeks. Thanks to help from great members of our community (like Exit Games) we have been able root out a number of bugs in the Unity Engine code and provide support for IPv6-only networks on the following platforms:

  • Editor: All platforms
  • Standalone player: All platforms
  • iOS
  • Android

We’ll continue to add support for IPv6-only networks on other platforms in the future.

What about older versions of Unity?

If you are using only WWW or UnityWebRequest APIs to access network resources you should be fine, though please test your games carefully.

We are also planning to backport our .NET/IL2CPP fixes to selected older lines of Unity and release them as 4.7.2, 5.1.5 and 5.2.5 updates.

What should you do?

First, test your game in IPv6-only setup to assess if all the game features work as intended. This guide from Apple goes through the setup of an IPv6-only testing network using a Mac with OS X 10.11 or later. This is the same testing that App Store reviewers will use, so it is a good place to start with IPv6 testing. Since IPv4 and IPv6 networks cannot interoperate, you must test on an IPv6-only network to ensure everything is working well. If your device has both IPv6 and IPv4 addresses, then socket operations could succeed using IPv4.

Second, audit your code for a few indicators of possible problems:

  • Look for the use of IPv4 addresses (e.g. 127.0.0.1, 8.8.4.4). Any use of such hardcoded addresses should be removed. Prefer host names, which can be used to look up the proper IPv4 or IPv6 address of a given device for the proper type of network.
  • Look for the use of the IPAddress.AddressFamily property. If the code branches based on the value of the property, is there a branch that handles IPv6 properly?
  • Look for the use of the IPAddress.Any and IPAddress.Loopback fields. These fields work with IPv4 addresses, not IPv6 addresses. Use the IPAddress.IPv6Any and IPAddress.IPv6Loopback fields as well to ensure IPv6 support.

If you encounter troubles beyond the ones mentioned above, please make sure you are using a build with the necessary fix in it. If a fix has not yet landed in your line (4.7.x, 5.1.x, 5.2.x), wait until we have released a patch with it. Then proceed to upgrade to this version.

Some of 3rd party native and managed networking plugins might also be not compatible with IPv6 networks, please consider reaching out plugin vendor for their compatibility status.

Finally, let us know if you encounter bugs in Unity related to IPv6. We will work hard to correct them as soon as possible. For issues specifically related to the App Store requirements, visit the iOS and tvOS development section of our forums. I’ll be hanging out there to help.

Update: 4.7.2 is live now: http://unity3d.com/get-unity/download/archive
Update #2: 5.2.5 is live too: http://unity3d.com/get-unity/download/archive (scroll down below 5.3.x updates).
Update #3: 5.1.5 is live too: http://unity3d.com/get-unity/download/archive (scroll down below 5.2.x updates).

55 replies on “Unity and IPv6 Support”

HI,
Does unity has any equivalent method to CAPI «getaddrinfo»?
I tried to synthesize an IPv6 address from IPv4 address manually, by using «Dns.GetHostEntry» and «Dns.GetHostAddresses», and none of them worked.
We need this, because some of our submissions using fixed prefix(«64:ff9b::») were rejected by Apple, though it works fine with our MAC sim testing pure ipv6 env.
Any suggestion?
Thank you!

I was planning to use this workaround too.
If you find any solution to it please post here or keep in touch via email!
Thank you!

Hi, I am deploying dedicated server made on UNET and when I start server I try to get list of all IPs (both IPv4 and IPv6). My server is deployed on Linux server on DigitalOcean with IPv6 support enabled, server can be pinged via IPv6 address. When I connect via IPv4 from client to server (from NetworkClient to NetworkServer) — everything works fine, however, when I connect via IPv6 — I get timeout error. I am using Unity 5.3. Strange thing is that it seems to work fine on Windows server, but doesn’t work on Linux. Can anybody help me out with this issue?

Grateful for 4.7.2 . Unfortunately it doesn’t work for me . My ipv6 code is failed . I build my ios player with il2cpp and the problem «An address incompatible with the requested protocol was used» is the same as using old unity version . The good news is that the same code works when i change the build setting to using mono(2.x) not using il2cpp . Maybe there are some bugs in il2cpp . And my work condition must uses il2cpp . Btw thanks unity .

HI, Our server has only ipv4 address, so We add the prefix»64:ff9b::» as you mentioned early, but it works only in one direction : it connect to the server, send data to the server(and server received it), but can not receive from the server, no data received. Receive code as follows( it works with ipv4, but not ipv6):
m_testSocket.BeginReceive(m_rcvBuff, m_rcvBuffEnd, RCV_BUFF_SIZE -m_rcvBuffEnd, SocketFlags.None, new AsyncCallback(ReceivedDataCallback), m_testSocket);

Any suggestion? Thanks!

4.7.2, thats nice…
I’m glad to hear that too.
I think Unity should not drop support for version 4.7.x until Unity 6 is out.
Which means Unity can keep supporting the last 2 Major releases (at least) concurrently. Many big software companies do support the current major version of their software + at least 1 previous major version.

So, we are heavily relying on AssetBundles in our game, and are currently using 5.2.4f1 for best performance. Assetbundle loading is heavily broken in the 5.3.4 patch line.

Any ETA on the IPV6 backport to 5.2.4f1 or a definitive Assetbundle fix for 5.3.4p1-6 ?

We are caught between two gamebreaking issues, and are facing the possibility of not being able to publish new content.

i try to use the socket to connect ipv6 address, it works fine in ipv4 and ipv6 networks, but has a 10051 err code in ipv6-only network. why?

WebGL routes all its networking through javascript (the browser) using external calls, so it uses whatever the browser is using.

I just scanned our game project for any IPAddress class usage. It looks like Unity Test Tools are using this class, perhaps you guys should update that to support the new requirements?

Comments are closed.