Unity Windows Phone 8 Build Error in Smartfox

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

Eser Telekom
Posts: 25
Joined: 16 Oct 2014, 07:28
Location: Istanbul
Contact:

Unity Windows Phone 8 Build Error in Smartfox

Postby Eser Telekom » 12 Nov 2014, 08:34

Unity v. : 4.5.5f1
Smartfox client v. :1.5.3.0

When i try to build for Windows Phone 8 in Unity, Error is occured. This problem smartfox v1.4.0 'in there

**Error building Player: Exception: Error: type `System.Timers.Timer` doesn't exist in target framework. It is referenced from SmartFox2X.dll at Sfs2X.SmartFox.**


Is it bug or What is my fault?
User avatar
Bax
Site Admin
Posts: 4610
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Unity Windows Phone 8 Build Error in Smartfox

Postby Bax » 12 Nov 2014, 15:36

Please read the Unity paragraph on this page: http://docs2x.smartfoxserver.com/Gettin ... harp#unity
Also read the text on this page: http://docs.unity3d.com/Manual/wp8-plugins.html
Let us know if something is not clear.
Paolo Bax
The SmartFoxServer Team
Eser Telekom
Posts: 25
Joined: 16 Oct 2014, 07:28
Location: Istanbul
Contact:

Re: Unity Windows Phone 8 Build Error in Smartfox

Postby Eser Telekom » 12 Nov 2014, 15:46

Unity v : 4.5.5f1
Smartfox Unity v.: 1.5.3.0
Smartfox Windows Phone (native) v : 1.5.3.0

Getting this error now :

Error building Player: Exception: Error: type `Windows.UI.Xaml.DispatcherTimer` doesn't exist in target framework. It is referenced from SmartFox2X.dll at Sfs2X.SmartFox.

I checked this :
http://forum.unity3d.com/threads/build- ... -5.250889/
User avatar
Bax
Site Admin
Posts: 4610
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Unity Windows Phone 8 Build Error in Smartfox

Postby Bax » 13 Nov 2014, 09:29

We could confirm the error you reported and fixed it.
Please download version 1.5.4 of the C# API at this url: http://www.smartfoxserver.com/download/sfs2x#p=client
Paolo Bax
The SmartFoxServer Team
Eser Telekom
Posts: 25
Joined: 16 Oct 2014, 07:28
Location: Istanbul
Contact:

Re: Unity Windows Phone 8 Build Error in Smartfox

Postby Eser Telekom » 13 Nov 2014, 10:00

I confirm that it is fixed.

Thank you.
ShawnHuss
Posts: 2
Joined: 13 Nov 2014, 02:07

Re: Unity Windows Phone 8 Build Error in Smartfox

Postby ShawnHuss » 13 Nov 2014, 13:45

thanks,
i downloaded the version 1.5.4 of the C# API and fixed the same error too.
But when i add the code to a empty project a new error is appered.
my code is:

Code: Select all

private SmartFox smartFox;
void Awake(){
   smartFox = new SmartFox (true);
}

the error is:

Code: Select all

Internal compiler error. See the console log for more information. output was:
Unhandled Exception: System.TypeLoadException: Could not load type 'Sfs2X.SmartFox' from assembly 'SmartFox2X, Version=1.5.4.0, Culture=neutral, PublicKeyToken=null'.

  at (wrapper managed-to-native) System.MonoType:GetMethodsByName (string,System.Reflection.BindingFlags,bool,System.Type)
  at System.MonoType.GetMethods (BindingFlags bindingAttr) [0x00000] in <filename unknown>:0
  at Mono.CSharp.MemberCache.AddMethods (BindingFlags bf, System.Type type) [0x00000] in <filename unknown>:0
  at Mono.CSharp.MemberCache.AddMethods (System.Type type) [0x00000] in <filename unknown>:0
  at Mono.CSharp.MemberCache..ctor (IMemberContainer container) [0x00000] in <filename unknown>:0

i upload the project.
please help me found the mistake,thank you very much.
Attachments
TestSmartFoxDll.zip
(206.27 KiB) Downloaded 615 times
Eser Telekom
Posts: 25
Joined: 16 Oct 2014, 07:28
Location: Istanbul
Contact:

Re: Unity Windows Phone 8 Build Error in Smartfox

Postby Eser Telekom » 13 Nov 2014, 13:58

Please read the Unity paragraph on this page: http://docs2x.smartfoxserver.com/Gettin ... harp#unity
Also read the text on this page: http://docs.unity3d.com/Manual/wp8-plugins.html

You have to put "Smartfox Windows Phone Native Plugin to Assets/Plugins/WP8 folder inside -> this is real dll
You also put Smartfox Unity Plugin to Unity Project folder (inside Assets folder , I recommend Assets/Plugin folders.) -> This fake dl.

Finally your project must have 2 smartfox.dll , one is real, other is fake
User avatar
Bax
Site Admin
Posts: 4610
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Unity Windows Phone 8 Build Error in Smartfox

Postby Bax » 13 Nov 2014, 15:21

I'm not sure what is going on in your project. Actually I can't even run it in Visual Studio Express 2012 for Windows Phone, as it can't locate the dependancies.

Anyway I did a similar test: i created a new project in Unity, added the two SmartFox2X.dll libraries and attached the following script to the main scene:

Code: Select all

using UnityEngine;
using System.Collections;
using Sfs2X;

public class MainScript : MonoBehaviour {

   // Use this for initialization
   void Start () {
      var smartFox = new SmartFox (true);
      Debug.Log ("This is the SmartFox instance: " + smartFox.ToString ());
   }
   
   // Update is called once per frame
   void Update () {
   
   }
}


The code runs fine in Unity and I can build for Windows Phone 8. I can also open the resulting project in Visual Studio and run it in the Windows Phone emulator without issues. I can send you my test project if you like, just send an email to the website's info mailbox requesting it.
Paolo Bax
The SmartFoxServer Team
ShawnHuss
Posts: 2
Joined: 13 Nov 2014, 02:07

Re: Unity Windows Phone 8 Build Error in Smartfox

Postby ShawnHuss » 07 Feb 2015, 12:03

i am so sorry for reply too late.i fix it by this way:
put the SmartFox2X.dll for wp8 to the "Plugin/WP8" folder of Unity.
put the SmartFox2X.dll for Unity to the "Plugin" folder of Unity.
then all is ok.
thans Bax, thanks Eser Telekom.
Attachments
folder.png
(2.54 KiB) Not downloaded yet

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 17 guests