Tasharen Entertainment Forum

Support => TNet 3 Support => Topic started by: Milkman on February 06, 2013, 04:37:01 PM

Title: Issue with isThisMyObject
Post by: Milkman on February 06, 2013, 04:37:01 PM
Hi.

I have a very simple project which spawns a prefab if it is hosting the game, or another prefab for the client. When I click these prefabs from the same client, the game logs information about the objectOwnerId.

The issue is that clicking the same prefab multiple times (from the same client) gives me different results. Sometimes I get the right result about the owner of the object, sometimes isThisMyObject returns a diffent result.

This is the Debug.log:

Player ID: 2 objectOwnerID: 2 isThisMyObject = True

Player ID: 2 objectOwnerID: 1 isThisMyObject = False

Is this the expected behavior of isThisMyObject??

If not, is there any known cause for this?

Thanks in advance.
Title: Re: Issue with isThisMyObject
Post by: ArenMook on February 06, 2013, 10:04:40 PM
isThisMyObject is supposed to be checked only once -- in the the Awake() function of a script attached to that object. It always points to the very last created object's flag.

In the next version TNObject gains the "isMine" flag that's actually permanent.
Title: Re: Issue with isThisMyObject
Post by: krissebesta on February 11, 2013, 05:13:12 PM
Great! When will the next version be available?  Thanks!
Title: Re: Issue with isThisMyObject
Post by: ArenMook on February 12, 2013, 09:21:43 AM
It was supposed to be available this weekend, but I moved to a new place and it delayed everything. I am also polishing the UPnP logic to work with non-gateway devices, so I'd say -- this weekend.
Title: Re: Issue with isThisMyObject
Post by: krissebesta on February 12, 2013, 09:44:06 PM
@ArenMook: Oh!  Does that mean some kind of automated port forwarding via NAT?  That would be slick!  I'm assuming the link below covers what you are working on?

http://en.wikipedia.org/wiki/Internet_Gateway_Device_Protocol

Thanks! - Kris
Title: Re: Issue with isThisMyObject
Post by: ArenMook on February 13, 2013, 01:25:21 PM
Yup. Here's example code:
  1. UPnP up = new UPnP();
  2. up.OpenTCP(5127);
  3. up.OpenUDP(5128);
...that's it. :)