Currently im trying to make a lobby system for my game, the lobby system seems to have quite a few issues but im slowly working my way through them. I cannot however, find out a way to make the host automatically get added as a player in the game, when he starts a server. There will never be a situation where the host will only act as the server, so i need him to automatically get added to the game.
I have tried a bunch of different things with ClientScene.AddPlayer() But i cannot make this work.
Further, i cannot find any documentation on what functions the different buttons on the standard unity network lobby hud actually do, so i have a hard time replicating the behaviour.
Anyone has any good sources /ideas on the issue?
There is a method in the given NetworkManager called StartHost(). Try this for starting the server.
See the Scripting API for NetworkManager.StartHost() and all the methods from the NetworkManager
You have to write a custom UI and network manager to eliminate the Start Server GUI option which is by default provide by the Unity Networking GUI component. You can view this simple tutorial (UI & Custom Net Manager) to understand it.
Related
I'm trying to rapidly preview and iterate on different Android vibrations that I'm making through Unity3D. Currently, the only way that I know how to successfully do this is to build the project each time. This is really tedious and takes a very long time. Are there any ways to rapidly test different vibrations?
I've tried using UnityRemote, which works great for quickly debugging just about everything Android related except vibrations. Vibrations don't really work in Unity Remote since it's mirroring the Unity player.
There is no way around the build process with Unity, other than the Unity Remote app. I would try to place as many Android vibrations in a single build as you can, and make an interface to test them all.
I've been learning to code C# Console Applications and to take it a step further would like to get into server based stuff. I thought a good simple way to do this would be to make a text based console game but online, just something turn based where each player waits to input. Since I have an old Pi laying around, I thought that would be a good option for the server.
Everything I find by searching though is much more complicated, usually a Unity game or JavaScript browser game. I just want to get used to the absolute basics of setting up a server and interacting with it from as scratch as possible.
If someone could point me in the right direction that would be great.
I'm writing a UWP application which I want to be able to use also in the Mixed Reality environment as a slate. It's not a 3D app.
All works well except that I would like to take advantage of the motion controller buttons as shortcuts. Everywhere I'm looking, I find an interface for Unity but I can't seem to find anything that would allow to me access the Motion Controller directly from my C# program.
Is it at all possible? And if yes, any pointers in the right direction would be greatly appreciated.
And please... don't ask me why I'm doing this... I'm starting to wonder myself but the project is well advanced and I want to finish it well.
It's possible to access motion controllers from UWP without Unity.
There is class SpatialInteractionManager. You need to get an instance by GetForCurrentView(). Then call every frame GetDetectedSourcesAtTimestamp() for getting sources like motion controllers. The details are in sample SpatialInteractionSource
I'm building a Unity3D client in C# for a multiplayer game that I made. The server is written in Node.js, and I wrote a web client in Javascript that works well. But I am running into lag issues with my Unity3D client implementation. I am using the websocket-sharp library, but have been unable to use it in the same way as I did on my Javascript client with the HTML5 Websocket class. I believe the issue lies in the way the websocket-sharp library is made, currently each Send() will cause a lock to _forSend, so the data will transmit like this:
data1:frg1
data1:frg2
data2:frg1
data2:frg2
...
But on my working javascript implementation, it looks like this as it is truly multithreaded:
data1:frg1
data2:frg1
data2:frg2
data1:frg2
Therefore I believe this is the cause of my lag with my C# Unity implementation, because the websockets-sharp library behaves like this. Can anyone confirm that this is an issue with the websockets-sharp library or suggest a library that would work?
you can see my simple SignalR unity client and create simple one for your node.js server, then see if the lag still present or not. https://github.com/Mo-Rahemi/WebGlGameWithSignalRClient
from my experience the lag should happens because of :
if your fps is low then java script calls affects too.as unity is single threaded and Webgl not support C# threads you have to handle incoming update in unity main thread. let say your server send update every 50 ms, so you have 20 java script call per second, so if your fps is under 20 frame per second your game go behind the server.
if your server update rate is too high it would be the problem because of tcp protocol of websocket ... .
interpolation, if your server sends 20 update per second depend on your player move speed you may have jumping issue in game client. so you must first queue them and interpolate between updates smoothly.
as websocket-sharp is a known library i think it shouldn't be problem, perhaps you are using it in bad way but we need see the code sample to help.
I used Socket.IO for Unity in my project and it work. I implement to create notification for my game example when someone aware a gilf ....
https://www.assetstore.unity3d.com/en/#!/content/21721
I am creating an app with multiple functionalities one of those needs access to front facing camera. I do not set it as a necessity to install the app in the manifest because I want the user to have access to the other functionalities even if front facing camera is not present. I do need however to notify the user whenever he starts said functionality that front facing camera is needed and it cannot run. How can that be done programmatically?
I have searched around the web and only found ways to exclude devices that do not have a front facing camera. That is not what I need however and I am wondering if it is even possible to do so....
The Microsoft.Devices.Camera class offers information like
Camera.IsCameraTypeSupported(CameraType.FrontFacing)
I've found more info about creating and manipulating cameras here on MSDN.