question

vivecuervo7 avatar image
vivecuervo7 asked

Unity 2018.3 - Unity.WWW now obsolete

Just upgraded Unity to latest stable version 2018.3.0f2 and started running into a logcat error on build (yet not in editor). After spending the day trying to track down the issue with no luck, I did notice that Unity have now marked Unity.WWW as obsolete with the following warning.

Assets\PlayFabSdk\Shared\Internal\PlayFabHttp\PlayFabWWW.cs(211,48): warning CS0618: 'WWW' is obsolete: 'Use UnityWebRequest, a fully featured replacement which is more efficient and has additional features'

It's still being used in a few places throughout PlayFab scripts, now I'm not sure if that's linked to any of the issues I've been having, but it's the first place I'm able to find something that isn't right. Just wondering if this is affecting anything and whether it's likely to be updated soon? If it's the cause of my issues with builds and an update is on the way, it'll save me from going on a wild goose chase. I'll include a screenshot of the logcat error just in case it is related and helpful.

unity3dsdks
logcat-error.png (29.3 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
JayZuo avatar image
JayZuo answered

Although Unity.WWW is obsolete, but for now, you should still be able to use it. And PlayFab Unity SDK gives you the option to choose request type. For UNITY 2017.2 or newer, it will use UnityWebRequest by default. You can change this in either Unity Editor Extensions or PlayFabSharedSettings. So for your issue, I'd think it's not related to Unity.WWW. Please recheck your code and the request you've made to see why you got a NullReferenceException. And if you still have this issue, please share more details, a minimal sample would be better.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

vivecuervo7 avatar image vivecuervo7 commented ·

Update: Looks like the problem is fixed, all came from Unity's code stripping. Disabled it and the build worked properly. I don't know if there's a way to force Unity to not strip certain parts of code out, but from what I could see the responses were all good, more likely it had thrown away some of the json deserializtion stuff. Thanks for the info on the WWW stuff too - going back through the code I was able to see what you meant. Always nice to understand what's happening behind the scenes!

--

I've been able to isolate where the issue is. The error isn't being shown in the Unity editor's console, found it after attaching Visual Studio to the built app and reverting to Mono from IL2CPP. Good fun! Error found at

PlayFabSdk\Shared\Internal\PlayFabHttp\PlayFabUnityHttp.cs

The only part of this that really has me stumped is the fact that it runs perfectly fine in Unity's Editor, it just fails on the built apk. I'll keep digging, but finally I have a starting point. I'm guessing this is most likely an incompatibility with the latest Unity, if that's the case and I find a workaround I'll post it up here.

0 Likes 0 ·
kevin-6 avatar image kevin-6 commented ·

Do you have a timeline for when the SDK would be updated to remove it's uses of WWW? It should work for now, but it introduces warnings in our build that we would like to remove.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.