I have a program I have developed which uses Unity3D to connect to a smartfox 2X server. This program works as a Windows Standalone and Android app. I am currently trying to get this to work for Windows Store builds. I have read at the following link that Unity for Window Store builds does not support networking:
http://docs.unity3d.com/Documentation/M ... arted.html
I'm not sure if this means you cannot use SmartFox with to build Windows Store apps with Unity or not, but since there are new API's available on here, I can't image that that is the case.
I have downloaded the updated API's from the smartfox website and deployed them to my project. I have the main Unity DLL in my Assets/Plugins folder, and the WIN8 DLL in my Assets/Metro/Plugins folder. After commenting out any lines that used 'Security' (ie. Security.PrefetchPolicy was causing errors) I have tested and the program still works as a Windows Standalone. I've even gotten this to run in Visual Studio, and everything seems to work there except that the program cannot connect to the server.
Has anyone had any success with this sort of setup, or has any resources they can point me to that could help? I've tried the same thing with the examples provided and get the same result. Am I going to have to just wait until Unity supports networking in Windows Store builds?
Using SmartFox 2X with Unity3D to publish Windows Store App
Re: Using SmartFox 2X with Unity3D to publish Windows Store
Did you set the Capabilities to InternetClient, InternetClientServer, PrivateNetworkClientServer from within the Player Settings in Unity?
(click on the Player Settings button in the Build Settings panel, and scroll at the bottom of the settings in the inspector)
(click on the Player Settings button in the Build Settings panel, and scroll at the bottom of the settings in the inspector)
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Re: Using SmartFox 2X with Unity3D to publish Windows Store
Yes, I have those three options checked in both Unity and in Visual Studio. I am building my program as "D3D11 C# Solution" and using SDK 8.1.
The program runs fine from the Unity editor (although I have to close Unity and re-open it after switching to a Windows Store App build).
When I first try to compile the program in Unity, I get the following 3 errors:
1: Assets\Scripts\Network\SFS.cs(6,23): error CS0234: The type or namespace name 'Permissions' does not exist in the namespace 'System.Security' (are you missing an assembly reference?
2: Assets\Scripts\Network\SFS.cs(42,9): error CS0246: The type or namespace name 'ArrayList' could not be found (are you missing a using directive or an assembly reference?)
3: Assets\Scripts\Network\SFS.cs(43,9): error CS0246: The type or namespace name 'ArrayList' could not be found (are you missing a using directive or an assembly reference?)
I can run the program after commenting out these three lines (the second two I'm not worried about, they are just the default "message" array lists that came with the example scripts), as well as any reference to "System.Security (mainly the Security.PrefetchSocketPolicy calls). The first error worries me a bit, but the program still runs correctly in the editor without it.. so I moved on.
I then try to run the program in debug mode via VS, and after a few seconds I am prompted with a file browser window that is looking for the file "error.cpp". When I cancel that I get the following error :
Unhandled exception at 0x755C9C6D (combase.dll) in Template.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x0A89F42C, 0x00000001).
I can break it there or continue, and after two more errors are spit out the program breaks on it's own. The other two errors are :
Unhandled exception at 0x755C9BDB (combase.dll) in Template.exe: 0xC0000602: A fail fast exception occurred. Exception handlers will not be invoked and the process will be terminated immediately.
.. and then...
Template.exe has triggered a breakpoint.
Last but not least, I have tried placing the WIndows8 version of the smartfox dll in two places: first my "Assets/Plugins/Metro" folder, and then the "Assets/Metro/Plugins" folder. The former produces the error:
Error building Player: Exception: Could not load file or assembly 'file:///C:\Users\emoro_000\Documents\Touche'\Temp\StagingArea\Data\Managed\Plugins\SmartFox2X.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
the latter (ie. "Assets/Metro/Plugins") builds the VS project, but I have the issues listed above.
PS. I've tried all the same things with several of the SmartFox example files, all producing the same results.
The program runs fine from the Unity editor (although I have to close Unity and re-open it after switching to a Windows Store App build).
When I first try to compile the program in Unity, I get the following 3 errors:
1: Assets\Scripts\Network\SFS.cs(6,23): error CS0234: The type or namespace name 'Permissions' does not exist in the namespace 'System.Security' (are you missing an assembly reference?
2: Assets\Scripts\Network\SFS.cs(42,9): error CS0246: The type or namespace name 'ArrayList' could not be found (are you missing a using directive or an assembly reference?)
3: Assets\Scripts\Network\SFS.cs(43,9): error CS0246: The type or namespace name 'ArrayList' could not be found (are you missing a using directive or an assembly reference?)
I can run the program after commenting out these three lines (the second two I'm not worried about, they are just the default "message" array lists that came with the example scripts), as well as any reference to "System.Security (mainly the Security.PrefetchSocketPolicy calls). The first error worries me a bit, but the program still runs correctly in the editor without it.. so I moved on.
I then try to run the program in debug mode via VS, and after a few seconds I am prompted with a file browser window that is looking for the file "error.cpp". When I cancel that I get the following error :
Unhandled exception at 0x755C9C6D (combase.dll) in Template.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x0A89F42C, 0x00000001).
I can break it there or continue, and after two more errors are spit out the program breaks on it's own. The other two errors are :
Unhandled exception at 0x755C9BDB (combase.dll) in Template.exe: 0xC0000602: A fail fast exception occurred. Exception handlers will not be invoked and the process will be terminated immediately.
.. and then...
Template.exe has triggered a breakpoint.
Last but not least, I have tried placing the WIndows8 version of the smartfox dll in two places: first my "Assets/Plugins/Metro" folder, and then the "Assets/Metro/Plugins" folder. The former produces the error:
Error building Player: Exception: Could not load file or assembly 'file:///C:\Users\emoro_000\Documents\Touche'\Temp\StagingArea\Data\Managed\Plugins\SmartFox2X.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
the latter (ie. "Assets/Metro/Plugins") builds the VS project, but I have the issues listed above.
PS. I've tried all the same things with several of the SmartFox example files, all producing the same results.
Re: Using SmartFox 2X with Unity3D to publish Windows Store
My latest attempt:
Downloaded latest version of the examples and the api.
Imported the "Lobby" example into a new project. Currently using the "Standalone" build settings in Unity.
Changed settings to point to my local smartfox server. Ran the Lobby example (using the API that came with the example, not the latest API) and I connected and logged in to the server (checked my zone monitor on server and it shows me logged in there as well).
Replaced the existing Lobby SmartFox2X.dll file in the lobby program with the latest API version (SmartFox2X_Unity/SmartFox2X.dll from the latest API download)... still logs in without an error.
Created the sub-folder "Metro" under the "Plugins" folder and added the SmartFox2X_Win8/SmartFox2X.dll to it. Directory structure looks like this:
Program still tests and logins in Unity Editor (via Standalone build settings).
Now, I swap my build settings to Windows Store. Running a test in Unity Editor, everything connects as expected.
I try to build the program for Windows Store and immediately get the following errors:
Assets\Scripts\LobbyGUI.cs(6,23): error CS0234: The type or namespace name 'Permissions' does not exist in the namespace 'System.Security' (are you missing an assembly reference?)
Assets\Scripts\LobbyGUI.cs(35,10): error CS0246: The type or namespace name 'ArrayList' could not be found (are you missing a using directive or an assembly reference?)
I realize that I cannot use ArrayList for windows store builds, so I comment out any reference to it (seems it's only used for the messages being received anyway, so login should still work). The System.Security error worries me a bit, but I comment out any references to 'System.Security".
Unity Editor shows no errors, and so I hit play again to test... no problems, client connects and lets me login (still in Windows Store Build).
Now, I build the program for Windows Store. I get the following error:
Error building Player: Exception: Could not load file or assembly 'file:///C:\Users\emoro_000\Documents\New Unity Project\Temp\StagingArea\Data\Managed\Plugins\SmartFox2X.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
Going to "Player Settings" and checking the options for InternetClient, InternetClientServer and PrivateNetworkClientServer doesn't fix anything.
Up to this point I believe I've done everything as outlined in documentation. I was working on this for so long yesterday that I decided to move the Windows Store .dll from "Plugins>Metro" to "Metro>Plugins" and tried again... this allows me to build the project for Windows Store, but when debugging the program won't connect to the smartfox server at all.
My apologies for the length of this reply, but I figured a step-by-step outline might help in figuring out where I've gone wrong.
Downloaded latest version of the examples and the api.
Imported the "Lobby" example into a new project. Currently using the "Standalone" build settings in Unity.
Changed settings to point to my local smartfox server. Ran the Lobby example (using the API that came with the example, not the latest API) and I connected and logged in to the server (checked my zone monitor on server and it shows me logged in there as well).
Replaced the existing Lobby SmartFox2X.dll file in the lobby program with the latest API version (SmartFox2X_Unity/SmartFox2X.dll from the latest API download)... still logs in without an error.
Created the sub-folder "Metro" under the "Plugins" folder and added the SmartFox2X_Win8/SmartFox2X.dll to it. Directory structure looks like this:
Code: Select all
- Assets
-Plugins
-SmartFox2X.dll (main SFS dll file)
-Metro
-SmartFox2X.dll (Win8 SFS dll file)Now, I swap my build settings to Windows Store. Running a test in Unity Editor, everything connects as expected.
I try to build the program for Windows Store and immediately get the following errors:
Assets\Scripts\LobbyGUI.cs(6,23): error CS0234: The type or namespace name 'Permissions' does not exist in the namespace 'System.Security' (are you missing an assembly reference?)
Assets\Scripts\LobbyGUI.cs(35,10): error CS0246: The type or namespace name 'ArrayList' could not be found (are you missing a using directive or an assembly reference?)
I realize that I cannot use ArrayList for windows store builds, so I comment out any reference to it (seems it's only used for the messages being received anyway, so login should still work). The System.Security error worries me a bit, but I comment out any references to 'System.Security".
Unity Editor shows no errors, and so I hit play again to test... no problems, client connects and lets me login (still in Windows Store Build).
Now, I build the program for Windows Store. I get the following error:
Error building Player: Exception: Could not load file or assembly 'file:///C:\Users\emoro_000\Documents\New Unity Project\Temp\StagingArea\Data\Managed\Plugins\SmartFox2X.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
Going to "Player Settings" and checking the options for InternetClient, InternetClientServer and PrivateNetworkClientServer doesn't fix anything.
Up to this point I believe I've done everything as outlined in documentation. I was working on this for so long yesterday that I decided to move the Windows Store .dll from "Plugins>Metro" to "Metro>Plugins" and tried again... this allows me to build the project for Windows Store, but when debugging the program won't connect to the smartfox server at all.
My apologies for the length of this reply, but I figured a step-by-step outline might help in figuring out where I've gone wrong.
Re: Using SmartFox 2X with Unity3D to publish Windows Store
I did the same steps but using the Connector example (in order to avoid the modifications to the code to remove the ArrayList references).
Everything works fine for me and I never get that error:
The Windows 8 project is built successfully. I'm using Unity 4.3, but I did the same tests some weeks ago using Unity 4.2, and I got the same positive result.
I'm not sure how to help further. Maybe you can try contacting the Unity support.
Everything works fine for me and I never get that error:
Code: Select all
Error building Player: Exception: Could not load file or assembly 'file:///C:\Users\emoro_000\Documents\New Unity Project\Temp\StagingArea\Data\Managed\Plugins\SmartFox2X.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)I'm not sure how to help further. Maybe you can try contacting the Unity support.
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Re: Using SmartFox 2X with Unity3D to publish Windows Store
That's all I get? "It works for me, I dunno why it doesn't work for you"
Not even an attempt to help on what could potentially be a problem for other customers as well. Hell, even asking what operating system I'm using to narrow things down would have at least made it seem like you were interested in helping me get your product to work.
Thanks for convincing me to move to Photon before I spent money on your server. Now if only I could get the last two years I've wasted on SmartFox back.
Not even an attempt to help on what could potentially be a problem for other customers as well. Hell, even asking what operating system I'm using to narrow things down would have at least made it seem like you were interested in helping me get your product to work.
Thanks for convincing me to move to Photon before I spent money on your server. Now if only I could get the last two years I've wasted on SmartFox back.
Re: Using SmartFox 2X with Unity3D to publish Windows Store
I'm sorry you take it this way. I spent two hours this morning to setup the virtual machine and make a full test on both Windows 8 + Unity 4.2 and Windows 8.1 + Unity 4.3.
I don't think you are using a different operating system, because those two are the only ones supporting Window Store Apps.
If you can provide more informations I will do my best to help more, but I'm not sure what other informations you might provide as you already did a great job in describing the issue. The point now is that you get a compilation error that I don't get, and this is something out of our control. That's why I suggested to contact the Unity support.
If you like you can send me your project and I will test it on my machine.
I don't think you are using a different operating system, because those two are the only ones supporting Window Store Apps.
If you can provide more informations I will do my best to help more, but I'm not sure what other informations you might provide as you already did a great job in describing the issue. The point now is that you get a compilation error that I don't get, and this is something out of our control. That's why I suggested to contact the Unity support.
If you like you can send me your project and I will test it on my machine.
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team