Support => TNet 3 Support => Topic started by: phoenix on October 19, 2016, 09:34:50 PM
Title: adventures in upgrading from Tnet2 to Tnet3
Post by: phoenix on October 19, 2016, 09:34:50 PM
Hi Aren, I just wanted to document my adventures upgrading from Tnet2 to Tnet 3
The first issue I came across and resolved was the create methods Tnet2 TNManager.Create(PrefabGameObject,false); Tnet3 TNManager.Instantiate("OnCreate1",PrefabGameObject.name,false);
Now I need to put the PrefabGameObject in the resources folder whereas before I had an array of GameObjects on TNManager. I gather from the examples that this is the preferred/best way to instantiate in Tnet3?
The next Issue I had was getting the local IP, on my Mac my network interface status comes up as unknown for some reason so I had to change the code for TNTools static public List<NetworkInterface> networkInterfaces and add
Not sure why this was changed from Tnet2 to Tnet3 but I personally need to include OperationalStatus.Unknown
TNServerInstance is a MonoBehaviour which I had to comment out TNServerInstance {// : MonoBehaviour This is the same in Tnet2 and Tnet3, is there any particular reason why TNServerInstance is a monobehavior?
And then replaced all the broadcast function handlers to handle the events directly (easy)
Now as per our discussion in this http://www.tasharen.com/forum/index.php?topic=14881.0 (http://www.tasharen.com/forum/index.php?topic=14881.0) I have realized that the new Channels functionality solves the need for the rest of my Tnet 2 customization's and the next step will be to get back to the main Tnet3 code base with only the minor modifications noted above.
Title: Re: adventures in upgrading from Tnet2 to Tnet3
Post by: ArenMook on October 21, 2016, 08:52:30 PM
The Operation.Unknown is already like that in TNet 3. What version are you using?
The TNServerInstance is a MonoBehaviour because it needs the OnDestroy notification. If you choose to make it single threaded (#define SINGLE_THREADED) it also uses the Update function. I'm not sure why you were trying to change it.
Title: Re: adventures in upgrading from Tnet2 to Tnet3
Post by: phoenix on October 23, 2016, 03:22:17 PM
I had to change the function
static public List<IPAddress> localAddresses the line of code if (ni == null || ni.OperationalStatus != OperationalStatus.Up) continue;
changed to if (ni == null || ni.OperationalStatus != OperationalStatus.Up){ if(ni==null){ continue; } else{ } } This is not good code but shows where the problem is
Title: Re: adventures in upgrading from Tnet2 to Tnet3
Post by: ArenMook on October 24, 2016, 07:04:47 AM