parse-community / Parse-SDK-dotNET

Parse SDK for .NET, Xamarin, Unity.
http://parseplatform.org
Apache License 2.0
323 stars 260 forks source link

Unity 2018.2.20f1 switching runtime issue #307

Closed vaspotapov closed 5 years ago

vaspotapov commented 5 years ago

Hello, after switching runtime from 3.5 to 4.x Equivalent I've encountered this issue at the runtime

MissingMethodException: bool UnityEngine.Application.get_isWebPlayer() Parse.ParseClient.Initialize (Parse.ParseClient+Configuration configuration) (at <3a984a4e1cc34c4c8c294275204691d0>:0) Parse.ParseClient.Initialize (System.String applicationId, System.String dotnetKey) (at <3a984a4e1cc34c4c8c294275204691d0>:0) Parse.ParseInitializeBehaviour.Initialize () (at <3a984a4e1cc34c4c8c294275204691d0>:0) Parse.ParseInitializeBehaviour.Awake () (at <3a984a4e1cc34c4c8c294275204691d0>:0) UnityEngine.GameObject:SetActive() ParseInitializer:InitParse() (at Assets/Scripts/Services/Parse/ParseInitializer.cs:109) ParseInitializer:<InitWebConfig>m__1(Boolean) (at Assets/Scripts/Services/Parse/ParseInitializer.cs:74) GeneralExtensions:Call(Action1, Boolean) (at Assets/Scripts/Generic/Util/GeneralExtensions.cs:130)

c__Iterator0:MoveNext() (at Assets/Scripts/Generic/Util/ConnectionUtils.cs:37) UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)` I know it's related to https://github.com/parse-community/Parse-SDK-dotNET/issues/294, but I was not able to find clear answer there
vaspotapov commented 5 years ago

So any help would be appreciated

TobiasPott commented 5 years ago

Hi @vaspotapov

I don't think this issue is related with the runtime api compatibility as it refers to the isWebPlayer property of the UnityEngine.Application class which is/was independent of the .NET API.

The issue you are facing here is, that this property was removed from the Unity engine due to the deprecation of the WebPlayer target platform (in favor of the WebGL build pipeline) in 2017 or so (nor 100% sure which version lost the property finally, either it was 2017.x or 2018.x).

You might give us some details which version of parse you are currently using (one from nuget, compiled from this repository or any forked one). As they might differ in those details.

The last version of Parse with Unity support was build against Unity assemblies which still contained the isWebPlayer property, which will unfortunately not work with newer Unity versions unless you dig out the specific commit of the repository and change it for yourself.

The current state of this repository was made by Alex (@TheFanatr) and does not include specific support for Unity (which is planned for the future when a plugin system is reintroduced).

I don't have my modified repository up at the moment which includes some changes to support current Unity versions but is based on the latest version of this repo and thus might differ in the available features and is not considered ready for production (although we are using it for a product, we are not using the full set of Parse features). If you are eager to check it out I can put up the changes in a separate branch of my forked repository. Just let me know.

vaspotapov commented 5 years ago

Wow! I didn't expect this much informativity, thanks a lot! Yeah, we are using latest 1.7.0 compiled from this repository. And yes, I've figure out how to workaround this problem. But there is another one appears MissingMethodException: string UnityEngine.Application.get_bundleIdentifier() Parse.ParseClient.Initialize (Parse.ParseClient+Configuration configuration) (at <2c6e68dbec7145fba432780312d66236>:0) Parse.ParseClient.Initialize (System.String applicationId, System.String dotnetKey) (at <2c6e68dbec7145fba432780312d66236>:0) Parse.ParseInitializeBehaviour.Initialize () (at <2c6e68dbec7145fba432780312d66236>:0) Parse.ParseInitializeBehaviour.Awake () (at <2c6e68dbec7145fba432780312d66236>:0) UnityEngine.GameObject:SetActive()

And as you mentioned

The current state of this repository was made by Alex (@TheFanatr) and does not include specific support for Unity (which is planned for the future when a plugin system is reintroduced).

I assume that it is only possible way for use Parse service is to switch back to the .Net 3.5 version, right?

vaspotapov commented 5 years ago

Nevermind) resolved it)

TobiasPott commented 5 years ago

@vaspotapov although closed, could you list briefly what your solution was? Did you turn back .NET API compatibility level or also reverted to an older version of Unity in a way? (Just for the record, if someone else is coming across this thread).

vaspotapov commented 5 years ago

Offcourse. In PlatformHooks.Unity.cs we interested in two fields (bool isWebPlayer and string appDisplayVersion). So I just replaced declaration as this: isWebPlayer = Application.platform == RuntimePlatform.WebGLPlayer; appDisplayVersion = "com.companyName.gameName";

TobiasPott commented 5 years ago

Great, thank you for this information. I believe this will help others when they come across this issue =)

vaspotapov commented 5 years ago

Yeah, you're right) Thanks for time and help!