Author Topic: Unable to keep channel data persistent  (Read 1850 times)

Shifty Geezer

  • Full Member
  • ***
  • Thank You
  • -Given: 7
  • -Receive: 9
  • Posts: 226
    • View Profile
Unable to keep channel data persistent
« on: July 28, 2016, 02:52:09 PM »
I'm setting Channel 1's channel data to record the current party. When a new player joins, this should show them the current party for them to choose their character. However, the data is getting cleared somewhere. I don't leave the channel, and I have it set to persistent, but the data isn't remaining.

  1. IEnumerator Start ()    {
  2.         AiaVG_GameManager.instance.prepManagerCache = this;
  3.         // STALL
  4.         while (TNManager.isJoiningChannel) yield return null;
  5.                
  6.         currentParty[0] = 0;
  7.         currentParty[1] = TNManager.GetChannel (1).Get<int>(GLOBAL.KEY_PLAYER_ADV1);
  8.         currentParty[2] = TNManager.GetChannel (1).Get<int>(GLOBAL.KEY_PLAYER_ADV2);
  9.         currentParty[3] = TNManager.GetChannel (1).Get<int>(GLOBAL.KEY_PLAYER_ADV3);
  10.         currentParty[4] = TNManager.GetChannel (1).Get<int>(GLOBAL.KEY_PLAYER_ADV4);
  11.  
  12.         print ("Party "+currentParty[1] +currentParty[2] +currentParty[3] +currentParty[4] );
  13. }
  14.  
  15.  
  16. public void ButtonPressStart(){
  17.         // if solo game, start
  18.         if(AiaVG_GameManager.netMaxNumPlayers == 0){
  19.                 Application.LoadLevel ("Adventuring");
  20.         }else{
  21.                 // network game
  22.                 print ("Party "+currentParty[1] +currentParty[2] +currentParty[3] +currentParty[4] );
  23.  
  24.                 TNManager.GetChannel (1).Set(GLOBAL.KEY_PLAYER_ADV1, currentParty[1]);
  25.                 TNManager.GetChannel (1).Set(GLOBAL.KEY_PLAYER_ADV2, currentParty[2]);
  26.                 TNManager.GetChannel (1).Set(GLOBAL.KEY_PLAYER_ADV3, currentParty[3]);
  27.                 TNManager.GetChannel (1).Set(GLOBAL.KEY_PLAYER_ADV4, currentParty[4]);
  28.                        
  29.                 TNManager.JoinChannel(2,"Adventuring", false, AiaVG_GameManager.netMaxNumPlayers, "", false);
  30.         }
  31. }
  32.  

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Unable to keep channel data persistent
« Reply #1 on: July 29, 2016, 10:35:34 AM »
You're doing it wrong. You should be using TNManager.SetChannelData and TNManager.GetChannelData, like it's shown in the tutorials.

Shifty Geezer

  • Full Member
  • ***
  • Thank You
  • -Given: 7
  • -Receive: 9
  • Posts: 226
    • View Profile
Re: Unable to keep channel data persistent
« Reply #2 on: July 29, 2016, 04:04:32 PM »
Okay. I had tried that but something hadn't worked, probably wrong syntax. To my mild defence, GetChannelData isn't mentioned in the Channel Data tutorial and only now looking do I see it covered in DataNode tutorial, though if I'd paid a little more attention I'd have seen the proper syntax in the tooltip.