Several days ago “Unity 5 beta 1” was leaked to the web. And I think that it is time to start migration of my game project to new Unity version.
Unity provide you a tool for updating your code. This would be an error message about updating the code and you need to click it. But it doesn’t help me a lot.
Removed quick property accessors, like .rigidBody, .rigidbody2D, .camera, .light, .animation, .constantForce, .renderer, .audio, .networkView, .guiTexture, .collider, .collider2D, .particleSystem, .particleEmitter, .guiText, .hingeJoint for modularization. Instead, use GetComponent<T> to get references.
This will force you to change a lot of legacy code because it was more fast and useful to user short property instead of GetComponent, but Unity decided to drop it for modularization reasons.
2. “transform” is now cached on the C# side, no more need to cache it yourself. And GetComponent performance was improved.
Good news. For better performance we usually cache transform value because access transform was the same as GetComponent(), but this operation was heavy.
3. Method and fields changes
SetTriangles instead SetTriangleStrip
orthographic instead isOrthographic (camera property)
“offset” instead of “center” property for BoxCollider2D
Works fine. You need manual change code according to changes I’ve mentioned.
Also don’t forget to change this lines of defines
#if !UNITY_3_5 && !UNITY_4_0 && !UNITY_4_1 && !UNITY_4_2 && !UNITY_4_3 && !UNITY_4_4 && !UNITY_4_5
Photon Cloud (PUN Plugin)
Also works fine but I had a problem with Ping class when try to build for Web GL. So just change Unityengine.Ping class to C#
System.Net.NetworkInformation.Ping ping = new System.Net.NetworkInformation.Ping();
System.Net.NetworkInformation.PingOptions options = new System.Net.NetworkInformation.PingOptions ();
options.DontFragment = true;
PingReply reply = ping.Send (regionIp);
while (reply.Status != IPStatus.Success/*!ping.isDone && Time.time < startTime + timeout*/)
// sometimes Unity ping never returns, so we use a timeout here
yield return 0;
Crash on user login. Somewhere inside the lib. I’ve already send crash report to Shephertz.
HTML5 support (WebGL build)
New define UNITY_WEBGL added.
After making all porting stuff I was not able to compile my project to HTML5. I have got an error messages:
Recursive Serialization is not supported. You can't dereference a PPtr while loading
Fatal error in Mono CIL Linker
Failed to resolve System.Collections.Hashtable UnityEngine.WWWForm::get_headers()
Angly Bots demo was compiled normally for HTML5. Compilation take match more time than for web player.
It is a first beta so it has some bugs and unfinished features. It crashes periodically. Looks like Web GL feature didn’t ready yet. Also there is no Tizen build target. So I think we need to wait more clear version.
But be ready to change your code because this version bring some significant changes.