Author Topic: Issue with isThisMyObject  (Read 4677 times)

Milkman

  • Guest
Issue with isThisMyObject
« 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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Issue with isThisMyObject
« Reply #1 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.

krissebesta

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 20
    • View Profile
Re: Issue with isThisMyObject
« Reply #2 on: February 11, 2013, 05:13:12 PM »
Great! When will the next version be available?  Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Issue with isThisMyObject
« Reply #3 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.

krissebesta

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 20
    • View Profile
Re: Issue with isThisMyObject
« Reply #4 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

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Issue with isThisMyObject
« Reply #5 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. :)