Tasharen Entertainment Forum

Support => TNet 3 Support => Topic started by: derkoi on May 19, 2014, 03:18:35 AM

Title: Syncing one gameobject child.
Post by: derkoi on May 19, 2014, 03:18:35 AM
In my game (a fishing simulator) the player sets up their fishing equipment where they want to fish after walking around the lake. Part of the equipment is a shelter, the other equipments is rods etc. All the objects are children of a 'holder' GameObject which I instantiate. I only want to sync the shelter across the network so other players can see there's someone fishing in that spot. I don't want to sync the rods etc etc.

At the moment I'm syncing the whole 'holder' object and it's working but is not what I want. Is there a way to select what child is synced on the network or will I have to instantiate what I want separately from the other items?

Another idea I had was to sync what player is fishing on what fishing spot & instantiate a shelter in that spot.

Any suggestions please?
Title: Re: Syncing one gameobject child.
Post by: ArenMook on May 19, 2014, 05:58:35 PM
You have to change the way to do your logic. If I understand correctly, you instantiate an object that has a TNObject script attached, but the actual scripts are on child objects? I assume the issue you're running into lies in the fact that you have several similar scripts on sub-objects, sharing the same IDs.

Instead you need to go through the central location -- through a single behaviour attached to the same game object as your TNObject script. Then either create different RFCs, like SetPlayer1Data, SetPlayer2Data, etc, or SetPlayerData passing an array of player data instead.