16
TNet 3 Support / Re: Send RFC Error on manuel added TNObject
« on: October 18, 2016, 11:57:07 AM »
Thank you very much for your explanation.
I put now my ChatUI on the main game scene. And this works now like a charm.
But if i switch the channel, for example if i switch from the main world to an dungeon, the TNO doesnt work anymore.
Must i put in every scene the ChatUI? Can't i transfer the tno to my new channel?
This is my test script to transfer the tnobject to my new channel.
If you see in the commands, in "OnJoinChannel" im not the owner of the current channel, so i can't transfer it.
I put now my ChatUI on the main game scene. And this works now like a charm.
But if i switch the channel, for example if i switch from the main world to an dungeon, the TNO doesnt work anymore.
Must i put in every scene the ChatUI? Can't i transfer the tno to my new channel?
This is my test script to transfer the tnobject to my new channel.
- public int lastChannelID = 0;
- protected override void OnEnable()
- {
- base.OnEnable();
- TNManager.onJoinChannel += OnJoinChannel;
- }
- void OnDisable()
- {
- TNManager.onJoinChannel -= OnJoinChannel;
- }
- private void OnJoinChannel(int channelID, bool success, string msg)
- {
- if(lastChannelID == 0) //configure our first world channel
- {
- Debug.Log("no Transfer");
- lastChannelID = channelID;
- }
- else if (lastChannelID > 0 && lastChannelID != channelID && tno.isMine) //we dont transfer because tno is not mine!
- {
- Debug.Log("Transfer");
- tno.TransferToChannel(channelID);
- lastChannelID = channelID;
- }
- Debug.Log("tno.isMine: " + tno.isMine); //tno is not mine!
- }
- void Awake ()
- {
- DontDestroyOnLoad(gameObject);
- }
If you see in the commands, in "OnJoinChannel" im not the owner of the current channel, so i can't transfer it.