Author Topic: Upgrading from 1.7.x to current  (Read 4411 times)

djray2k

  • Jr. Member
  • **
  • Thank You
  • -Given: 4
  • -Receive: 4
  • Posts: 74
  • Blockey Hockey!
    • View Profile
    • Walking Talking Grilling Bear Studios
Upgrading from 1.7.x to current
« on: September 06, 2014, 11:32:49 AM »
I decided to go ahead and upgrade to the latest version today.

After upgrading, I got this message: "Version mismatch! Server is running protocol version 9 while you are on version 11"

So I went to change the TNServer with the latest one.

This isn't so much an issue as it is just want to make sure everything is ok. I noticed it says "UPnP discovery failed." Everything has been working before normally, but is this something I should looki into to increase performance?



djray2k

  • Jr. Member
  • **
  • Thank You
  • -Given: 4
  • -Receive: 4
  • Posts: 74
  • Blockey Hockey!
    • View Profile
    • Walking Talking Grilling Bear Studios
Re: Upgrading from 1.7.x to current
« Reply #1 on: September 06, 2014, 02:15:12 PM »
Also, I was trying to test this on my windows phone, but I'm getting some errors when I build in in TNet classes:

Assets/TNet/Client/DataNode.cs(926,62): error CS1501: No overload for method `Create' takes `2' arguments

Assets/TNet/Client/DataNode.cs(937,54): error CS1061: Type `System.Type' does not contain a definition for `GetGenericArgument' and no extension method `GetGenericArgument' of type `System.Type' could be found (are you missing a using directive or an assembly reference?)

Assets/TNet/Client/DataNode.cs(960,54): error CS1061: Type `System.Type' does not contain a definition for `GetGenericArgument' and no extension method `GetGenericArgument' of type `System.Type' could be found (are you missing a using directive or an assembly reference?)


It builds correctly in Visual Studios, but when I try to build in in Unity that's when it happens.
« Last Edit: September 06, 2014, 02:50:43 PM by djray2k »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Upgrading from 1.7.x to current
« Reply #2 on: September 07, 2014, 08:59:55 AM »
GetGenericArgument extension method is in TNSerializer.cs, but only if there is reflection support. It should probably be taken outside the #if REFLECTION_SUPPORT section.

Not sure what the Create() one is. Our line numbers don't match and I don't have any Create calls that take 2 arguments. What's the full line?

UPnP discovery fails every so often, restart the server and chances are it will work again.

djray2k

  • Jr. Member
  • **
  • Thank You
  • -Given: 4
  • -Receive: 4
  • Posts: 74
  • Blockey Hockey!
    • View Profile
    • Walking Talking Grilling Bear Studios
Re: Upgrading from 1.7.x to current
« Reply #3 on: September 07, 2014, 11:01:28 AM »
GetGenericArgument extension method is in TNSerializer.cs, but only if there is reflection support. It should probably be taken outside the #if REFLECTION_SUPPORT section.

Not sure what the Create() one is. Our line numbers don't match and I don't have any Create calls that take 2 arguments. What's the full line?

UPnP discovery fails every so often, restart the server and chances are it will work again.



  1. ....
  2.  
  3. else if (!type.IsSubclassOf(typeof(Component)))
  4. {
  5.    bool isIList = type.Implements(typeof(System.Collections.IList));
  6.    bool isTList = (!isIList && type.Implements(typeof(TList)));
  7.  
  8.    mValue = (isTList || isIList) ? type.Create(children.size) : type.Create();
  9.  
  10.    if (mValue == null)
  11.    {
  12.        Debug.LogError("Unable to create a " + type);
  13.        return false;
  14.    }
  15.  
  16. ....
  17.  
  18.  

It's the "mValue = (isTList || isIList) ? type.Create(children.size) : type.Create();" line that Unity3D complains about. I was trying to fix it myself so it might be a line or two off.

I downloaded the latest version of TNet through email yesterday (Saturday), not the asset store. The readme file says 1.9.7. (Small note, the name of the file says 1.8.5)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Upgrading from 1.7.x to current
« Reply #4 on: September 07, 2014, 11:16:20 AM »
Move the extension Create methods outside the #if as well.
  1.         /// <summary>
  2.         /// Retrieve the generic element type from the templated type.
  3.         /// </summary>
  4.  
  5.         static public Type GetGenericArgument (this Type type)
  6.         {
  7.                 Type[] elems = type.GetGenericArguments();
  8.                 return (elems != null && elems.Length == 1) ? elems[0] : null;
  9.         }
  10.  
  11.         /// <summary>
  12.         /// Create a new instance of the specified object.
  13.         /// </summary>
  14.  
  15.         static public object Create (this Type type)
  16.         {
  17.                 try
  18.                 {
  19.                         return Activator.CreateInstance(type);
  20.                 }
  21.                 catch (Exception ex)
  22.                 {
  23.                         Debug.LogError(ex.Message);
  24.                         return null;
  25.                 }
  26.         }
  27.  
  28.         /// <summary>
  29.         /// Create a new instance of the specified object.
  30.         /// </summary>
  31.  
  32.         static public object Create (this Type type, int size)
  33.         {
  34.                 try
  35.                 {
  36.                         return Activator.CreateInstance(type, size);
  37.                 }
  38.                 catch (Exception)
  39.                 {
  40.                         return type.Create();
  41.                 }
  42.         }

djray2k

  • Jr. Member
  • **
  • Thank You
  • -Given: 4
  • -Receive: 4
  • Posts: 74
  • Blockey Hockey!
    • View Profile
    • Walking Talking Grilling Bear Studios
Re: Upgrading from 1.7.x to current
« Reply #5 on: September 07, 2014, 11:47:44 AM »
I tried to just move it outside the #if REFLECTION_SUPPORT part, but it then complained about it already existing in the #else part. At that point I had no idea what to do.

  1. static public object Create (this Type type)
  2. {
  3.         Debug.LogError("Can't create a " + type + " (reflection is not supported on this platform)");
  4.         return null;
  5. }

Sorry, I don't understand it enough to see what wrong.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Upgrading from 1.7.x to current
« Reply #6 on: September 08, 2014, 11:00:23 PM »
If you move, why would it exist in the previous location? If it still exists in the previous location then that's a copy, not a move.

If you're not sure of how to do this, just wait for the next update later this week.

djray2k

  • Jr. Member
  • **
  • Thank You
  • -Given: 4
  • -Receive: 4
  • Posts: 74
  • Blockey Hockey!
    • View Profile
    • Walking Talking Grilling Bear Studios
Re: Upgrading from 1.7.x to current
« Reply #7 on: September 10, 2014, 08:59:45 AM »
No, I didn't copy it. When I moved it outside the if preprocessor for Reflection, it wouldn't build because you have an else preprocessor that contains the Create Method that always returns null.