Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

MissingReferenceException && NullReferenceException

Discussion in 'Scripting' started by leorond, Mar 5, 2017.

  1. leorond

    leorond

    Joined:
    Mar 5, 2017
    Posts:
    8
    Hello, I have a mistake here who do not know.

    If you create a new character, and log into the game and after the emotion of the character to another account, deletes GameObject Player.

    If you re-enroll for the same ones bankroll, so everything runs fine.



    Here I attach scripts involved.

    Player.cs
    Code (CSharp):
    1. using DarkRift;
    2. using System;
    3. using UnityEngine;
    4. using UMA;
    5. using UMA.Integrations;
    6. using UMA.PoseTools;
    7. using Yasil;
    8.  
    9. namespace Yasil.Player
    10. {
    11.     public class Player : MonoBehaviour
    12.     {
    13.         #region Public variables
    14.  
    15.         public RuntimeAnimatorController _animController;
    16.         public Stats PlayerStats;
    17.         //public Vector3 myPosition = new Vector3(54f, 6f, 43f);
    18.         public Vector3 myPosition;
    19.         public Quaternion myRotation;
    20.         public UMAExpressionPlayer expressionPlayer;
    21.  
    22.         public float speed;
    23.         public float oldspeed;
    24.         public float direction;
    25.         public float olddirection;
    26.         public int motion;
    27.         public int oldmotion;
    28.         public int state;
    29.         public int oldstate;
    30.  
    31.         #endregion Public variables
    32.  
    33.         #region Private variables
    34.  
    35.         [SerializeField]
    36.         private int userID;
    37.  
    38.         [SerializeField]
    39.         private string playerName;
    40.  
    41.         [SerializeField]
    42.         private string playerGender;
    43.  
    44.         [SerializeField]
    45.         private string playerRace;
    46.  
    47.         [SerializeField]
    48.         private int networkID;
    49.  
    50.         private UMADynamicAvatar _myumaDynamicAvatar;
    51.         private UMAData _myumaData;
    52.         private UMADnaHumanoid _umaDNA;
    53.         private UMADnaTutorial _umaTutorialDNA;
    54.         private UMAContext umaContext;
    55.         private UMAGenerator umaGenerator;
    56.  
    57.         private int _numberOfSlots = 40;
    58.  
    59.         #endregion Private variables
    60.  
    61.         #region Getter Setters
    62.  
    63.         public int NetworkID { get { return networkID; } private set { networkID = value; } }
    64.         public int UserID { get { return userID; } private set { userID = value; } }
    65.         public string PlayerName { get { return playerName; } private set { playerName = value; } }
    66.         public string PlayerGender { get { return playerGender; } private set { playerGender = value; } }
    67.         public string PlayerRace { get { return playerRace; } private set { playerRace = value; } }
    68.  
    69.         #endregion Getter Setters
    70.  
    71.         #region Delegates
    72.  
    73.         public delegate void MyUmaReadyEventHandler();
    74.  
    75.         #endregion Delegates
    76.  
    77.         #region Events
    78.  
    79.         public static event MyUmaReadyEventHandler onMyUmaReady;
    80.  
    81.         #endregion Events
    82.  
    83.         private void Awake()
    84.         {
    85.             umaGenerator = GameObject.Find("UMAGenerator").GetComponent<UMAGenerator>();
    86.             umaContext = GameObject.Find("UMAContext").GetComponent<UMAContext>();
    87.         }
    88.  
    89.         private void Start()
    90.         {
    91.             NetworkID = DarkRiftAPI.id;
    92.             PlayerManager.onPlayerLoadOK += MakePlayer;
    93.             PlayerManager.LoadPlayer();
    94.         }
    95.  
    96.         private void OnApplicationQuit()
    97.         {
    98.             PlayerManager.onPlayerLoadOK -= MakePlayer;
    99.         }
    100.  
    101.         private void Update()
    102.         {
    103.             if (DarkRiftAPI.isConnected)
    104.             {
    105.                 if (speed != oldspeed && motion == 0)
    106.                 {
    107.                     DarkRiftAPI.SendMessageToOthers(NT.MoveT, NT.MoveS.Speed, speed);
    108.                     oldspeed = speed;
    109.                     if (transform.position != myPosition && speed == 0)
    110.                     {
    111.                         float deltaPositionx = transform.position.x - myPosition.x;
    112.                         float deltaPositionz = transform.position.z - myPosition.z;
    113.                         if ((deltaPositionx > 0.1f || deltaPositionx < -0.1f) || (deltaPositionz > 0.1f || deltaPositionz < -0.1f))
    114.                         {
    115.                             DarkRiftAPI.SendMessageToOthers(NT.MoveT, NT.MoveS.Position, transform.position);
    116.  
    117.                             using (DarkRiftWriter writer = new DarkRiftWriter())
    118.                             {
    119.                                 writer.Write(userID);
    120.                                 writer.Write(transform.position.x);
    121.                                 writer.Write(transform.position.y);
    122.                                 writer.Write(transform.position.z);
    123.                                 DarkRiftAPI.SendMessageToServer(NT.PlayerT, NT.PlayerS.playerSavePos, writer);
    124.                             }
    125.                         }
    126.                         myPosition = transform.position;
    127.                     }
    128.                 }
    129.                 if (direction != olddirection && motion == 0)
    130.                 {
    131.                     DarkRiftAPI.SendMessageToOthers(NT.MoveT, NT.MoveS.Direction, direction);
    132.                     olddirection = direction;
    133.                     if (transform.rotation != myRotation && direction == 0)
    134.                     {
    135.                         DarkRiftAPI.SendMessageToOthers(NT.MoveT, NT.MoveS.Rotation, transform.rotation);
    136.                     }
    137.                     myRotation = transform.rotation;
    138.                 }
    139.  
    140.                 if (motion != 0 || motion != oldmotion)
    141.                 {
    142.                     DarkRiftAPI.SendMessageToOthers(NT.MoveT, NT.MoveS.Motion, motion);
    143.                     oldmotion = motion;
    144.                 }
    145.                 if (state != 0 || state != oldstate)
    146.                 {
    147.                     DarkRiftAPI.SendMessageToOthers(NT.MoveT, NT.MoveS.State, state);
    148.                     oldstate = state;
    149.                 }
    150.             }
    151.         }
    152.  
    153.         public string GetUMARecipe()
    154.         {
    155.             byte[] _myplayerbytes;
    156.  
    157.             UMATextRecipe recipe = ScriptableObject.CreateInstance<UMATextRecipe>();
    158.             recipe.Save(_myumaDynamicAvatar.umaData.umaRecipe, umaContext);
    159.             _myplayerbytes = recipe.GetBytes();
    160.  
    161.             return PlayerManager.Compress(_myplayerbytes);
    162.         }
    163.  
    164.         //public void SaveMyPlayer()
    165.         //{
    166.             //PlayerManager.SavePlayer(userID, playerName, playerRace, playerGender, GetUMARecipe());
    167.         //}
    168.  
    169.         public void MakePlayer(int _userID, string _playername, string _playergender, string _playerrace, byte[] _umadata, Stats _mystats, Vector3 _pos)
    170.         {
    171.             UserID = _userID;
    172.             PlayerName = _playername;
    173.             PlayerGender = _playergender;
    174.             PlayerRace = _playerrace;
    175.             PlayerStats = _mystats;
    176.             myPosition = _pos;
    177.             MakeUMA(_umadata);
    178.  
    179.             if (onMyUmaReady != null)
    180.                 onMyUmaReady();
    181.         }
    182.  
    183.         private void MakeUMA(byte[] _umarecipe)
    184.         {
    185.             GameObject GO = GameObject.Find("Player");
    186.             GO.transform.parent = this.transform;
    187.  
    188.             transform.position = myPosition;
    189.  
    190.             _myumaDynamicAvatar = GO.AddComponent<UMADynamicAvatar>();
    191.             _myumaDynamicAvatar.Initialize();
    192.             _myumaData = _myumaDynamicAvatar.umaData;
    193.             _myumaDynamicAvatar.umaGenerator = umaGenerator;
    194.             _myumaData.umaGenerator = umaGenerator;
    195.             _myumaData.umaRecipe.slotDataList = new SlotData[_numberOfSlots];
    196.             _umaDNA = new UMADnaHumanoid();
    197.             _umaTutorialDNA = new UMADnaTutorial();
    198.             _myumaData.umaRecipe.AddDna(_umaDNA);
    199.             _myumaData.umaRecipe.AddDna(_umaTutorialDNA);
    200.  
    201.             UMATextRecipe recipe = ScriptableObject.CreateInstance<UMATextRecipe>();
    202.             recipe.SetBytes(_umarecipe);
    203.             _myumaDynamicAvatar.Load(recipe);
    204.  
    205.             Destroy(recipe);
    206.  
    207.             _myumaDynamicAvatar.umaData.OnCharacterCreated += CharacterReadyCallBack;
    208.  
    209.             _myumaDynamicAvatar.animationController = _animController;
    210.             _myumaDynamicAvatar.UpdateNewRace();
    211.         }
    212.  
    213.         public void CharacterReadyCallBack(UMAData _umaData)
    214.         {
    215.             UMAExpressionSet _expressionSet = _umaData.umaRecipe.raceData.expressionSet;
    216.             expressionPlayer = _umaData.gameObject.AddComponent<UMAExpressionPlayer>();
    217.             expressionPlayer.expressionSet = _expressionSet;
    218.             expressionPlayer.umaData = _umaData;
    219.             expressionPlayer.Initialize();
    220.             expressionPlayer.enableBlinking = true;
    221.             expressionPlayer.enableSaccades = true;
    222.             CapsuleColliderSlotScript myCC = _umaData.gameObject.AddComponent<CapsuleColliderSlotScript>();
    223.             myCC.OnDnaApplied(_umaData);
    224.             gameObject.AddComponent<PlayerController>();
    225.         }
    226.  
    227.         private void SlotAdd(int _slot, string _slotName, SlotLibrary _lib)
    228.         {
    229.             _myumaData.umaRecipe.slotDataList[_slot] = _lib.InstantiateSlot(_slotName);
    230.         }
    231.     }
    232. }
    PlayerOthers.cs
    Code (CSharp):
    1. using DarkRift;
    2. using System;
    3. using UMA;
    4. using UMA.PoseTools;
    5. using UnityEngine;
    6. using Yasil;
    7.  
    8. namespace Yasil.Player
    9. {
    10.     public class PlayerOthers : MonoBehaviour
    11.     {
    12.         #region Public variable
    13.  
    14.         public RuntimeAnimatorController _animController;
    15.         public UMAExpressionPlayer expressionPlayer;
    16.         public float speed;
    17.         public float direction;
    18.         public int motion;
    19.         public int state;
    20.        
    21.         //public Vector3 myPosition = new Vector3(54f, 6f, 43f);
    22.         public Vector3 myPosition;
    23.  
    24.         #endregion Public variable
    25.  
    26.         #region Private variables
    27.  
    28.         [SerializeField]
    29.         private int userID;
    30.  
    31.         [SerializeField]
    32.         private string playerName;
    33.  
    34.         [SerializeField]
    35.         private string playerGender;
    36.  
    37.         [SerializeField]
    38.         private string playerRace;
    39.  
    40.         [SerializeField]
    41.         private int networkID;
    42.  
    43.         private UMADynamicAvatar _myumaDynamicAvatar;
    44.         private UMAData _myumaData;
    45.         private UMADnaHumanoid _umaDNA;
    46.         private UMADnaTutorial _umaTutorialDNA;
    47.         private UMAContext umaContext;
    48.         private UMAGenerator umaGenerator;
    49.  
    50.         private int _numberOfSlots = 40;
    51.  
    52.  
    53.         #endregion Private variables
    54.  
    55.         #region Getter Setters
    56.  
    57.         public int NetworkID { get { return networkID; } private set { networkID = value; } }
    58.         public int UserID { get { return userID; } private set { userID = value; } }
    59.         public string PlayerName { get { return playerName; } private set { playerName = value; } }
    60.         public string PlayerGender { get { return playerGender; } private set { playerGender = value; } }
    61.         public string PlayerRace { get { return playerRace; } private set { playerRace = value; } }
    62.  
    63.         #endregion Getter Setters
    64.  
    65.         private void Awake()
    66.         {
    67.             umaGenerator = GameObject.Find("UMAGenerator").GetComponent<UMAGenerator>();
    68.             umaContext = GameObject.Find("UMAContext").GetComponent<UMAContext>();
    69.         }
    70.  
    71.         private void Start()
    72.         {
    73.             DarkRiftAPI.onDataDetailed += ReceiveData;
    74.             DarkRiftAPI.onPlayerDisconnected += OtherPlayerQuit;
    75.         }
    76.  
    77.         public void OtherPlayerQuit(ushort id)
    78.         {
    79.             DarkRiftAPI.onDataDetailed -= ReceiveData;
    80.             DarkRiftAPI.onPlayerDisconnected -= OtherPlayerQuit;
    81.         }
    82.  
    83.         private void ReceiveData(ushort senderID, byte tag, ushort subject, object data)
    84.         {
    85.             if (senderID == networkID)
    86.             {
    87.                 if (tag == NT.MoveT)
    88.                 {
    89.                     #region Move Player
    90.  
    91.                     if (subject == NT.MoveS.Speed)
    92.                     {
    93.                         speed = (float)data;
    94.                     }
    95.                     if (subject == NT.MoveS.Direction)
    96.                     {
    97.                         direction = (float)data;
    98.                     }
    99.                     if (subject == NT.MoveS.Motion)
    100.                     {
    101.                         motion = (int)data;
    102.                     }
    103.                     if (subject == NT.MoveS.Position)
    104.                     {
    105.                         transform.position = (Vector3)data;
    106.                     }
    107.                     if (subject == NT.MoveS.Rotation)
    108.                     {
    109.                         transform.rotation = (Quaternion)data;
    110.                     }
    111.                     if (subject == NT.MoveS.State)
    112.                     {
    113.                         state = (int)data;
    114.                     }
    115.  
    116.                     #endregion Move Player
    117.                 }
    118.             }
    119.         }
    120.  
    121.         public void MakePlayer(int _senderID, int _userID, string _playername, string _playergender, string _playerrace, byte[] _umadata, Vector3 _pos)
    122.         {
    123.             _animController = GameObject.Find("Player").GetComponent<Player>()._animController;
    124.             UserID = _userID;
    125.             PlayerName = _playername;
    126.             PlayerGender = _playergender;
    127.             PlayerRace = _playerrace;
    128.             NetworkID = _senderID;
    129.             myPosition = _pos;
    130.             MakeUMA(_umadata);
    131.         }
    132.  
    133.         private void MakeUMA(byte[] _umarecipe)
    134.         {
    135.             GameObject GO = GameObject.Find("Player-" + NetworkID.ToString());
    136.             GO.transform.parent = this.transform;
    137.  
    138.             transform.position = myPosition;
    139.  
    140.             _myumaDynamicAvatar = GO.AddComponent<UMADynamicAvatar>();
    141.             _myumaDynamicAvatar.Initialize();
    142.             _myumaData = _myumaDynamicAvatar.umaData;
    143.             _myumaDynamicAvatar.umaGenerator = umaGenerator;
    144.             _myumaData.umaGenerator = umaGenerator;
    145.             _myumaData.umaRecipe.slotDataList = new SlotData[_numberOfSlots];
    146.             _umaDNA = new UMADnaHumanoid();
    147.             _umaTutorialDNA = new UMADnaTutorial();
    148.             _myumaData.umaRecipe.AddDna(_umaDNA);
    149.             _myumaData.umaRecipe.AddDna(_umaTutorialDNA);
    150.  
    151.             UMATextRecipe recipe = ScriptableObject.CreateInstance<UMATextRecipe>();
    152.             recipe.SetBytes(_umarecipe);
    153.             _myumaDynamicAvatar.Load(recipe);
    154.  
    155.             Destroy(recipe);
    156.  
    157.             _myumaDynamicAvatar.umaData.OnCharacterCreated += CharacterReadyCallBack;
    158.  
    159.             _myumaDynamicAvatar.animationController = _animController;
    160.             _myumaDynamicAvatar.UpdateNewRace();
    161.         }
    162.  
    163.         public void CharacterReadyCallBack(UMAData _umaData)
    164.         {
    165.             UMAExpressionSet _expressionSet = _umaData.umaRecipe.raceData.expressionSet;
    166.             expressionPlayer = _umaData.gameObject.AddComponent<UMAExpressionPlayer>();
    167.             expressionPlayer.expressionSet = _expressionSet;
    168.             expressionPlayer.umaData = _umaData;
    169.             expressionPlayer.Initialize();
    170.             expressionPlayer.enableBlinking = true;
    171.             expressionPlayer.enableSaccades = true;
    172.             CapsuleColliderSlotScript myCC = _umaData.gameObject.AddComponent<CapsuleColliderSlotScript>();
    173.             myCC.OnDnaApplied(_umaData);
    174.             gameObject.AddComponent<OthersAnimController>();
    175.         }
    176.  
    177.         private void SlotAdd(int _slot, string _slotName, SlotLibrary _lib)
    178.         {
    179.             _myumaData.umaRecipe.slotDataList[_slot] = _lib.InstantiateSlot(_slotName);
    180.         }
    181.     }
    182. }
    PlayerOthersManager.cs
    Code (CSharp):
    1. using DarkRift;
    2. using System.Collections;
    3. using UnityEngine;
    4. using Yasil;
    5.  
    6. namespace Yasil.Player
    7. {
    8.     public class PlayerOthersManager : MonoBehaviour
    9.     {
    10.         private Player _myPlayer;
    11.  
    12.         private void Start()
    13.         {
    14.             _myPlayer = GameObject.Find("Player").GetComponent<Player>();
    15.  
    16.             DarkRiftAPI.onDataDetailed += ReceiveData;
    17.             DarkRiftAPI.onPlayerDisconnected += PlayerDisconnected;
    18.             Player.onMyUmaReady += SendIamNew;
    19.         }
    20.  
    21.         private void SendIamNew()
    22.         {
    23.             if (DarkRiftAPI.isConnected)
    24.             {
    25.                 DarkRiftAPI.SendMessageToOthers(NT.StartT, NT.StartS.JoinGame, "HI JOE");
    26.  
    27.                 using (DarkRiftWriter writer = new DarkRiftWriter())
    28.                 {
    29.                     writer.Write(_myPlayer.UserID);
    30.                     writer.Write(_myPlayer.PlayerName);
    31.                     writer.Write(_myPlayer.PlayerGender);
    32.                     writer.Write(_myPlayer.PlayerRace);
    33.  
    34.                     writer.Write(_myPlayer.GetUMARecipe());
    35.                     writer.Write((float)_myPlayer.myPosition.x);
    36.                     writer.Write((float)_myPlayer.myPosition.y);
    37.                     writer.Write((float)_myPlayer.myPosition.z);
    38.                     DarkRiftAPI.SendMessageToOthers(NT.StartT, NT.StartS.Spawn, writer);
    39.                 }
    40.             }
    41.         }
    42.  
    43.         private void ReceiveData(ushort senderID, byte tag, ushort subject, object data)
    44.         {
    45.             if (tag == NT.StartT)
    46.             {
    47.                 if (subject == NT.StartS.JoinGame)
    48.                 {
    49.                     using (DarkRiftWriter writer = new DarkRiftWriter())
    50.                     {
    51.                         writer.Write(_myPlayer.UserID);
    52.                         writer.Write(_myPlayer.PlayerName);
    53.                         writer.Write(_myPlayer.PlayerGender);
    54.                         writer.Write(_myPlayer.PlayerRace);
    55.  
    56.                         writer.Write(_myPlayer.GetUMARecipe());
    57.                         writer.Write((float)_myPlayer.myPosition.x);
    58.                         writer.Write((float)_myPlayer.myPosition.y);
    59.                         writer.Write((float)_myPlayer.myPosition.z);
    60.                         DarkRiftAPI.SendMessageToID(senderID, NT.StartT, NT.StartS.Spawn, writer);
    61.                     }
    62.                 }
    63.                 if (subject == NT.StartS.Spawn)
    64.                 {
    65.                     using (DarkRiftReader reader = (DarkRiftReader)data)
    66.                     {
    67.                         int _id = reader.ReadInt32();
    68.                         string _playername = reader.ReadString();
    69.                         string _playergender = reader.ReadString();
    70.                         string _playerrace = reader.ReadString();
    71.                         string _umadata = reader.ReadString();
    72.                         float _posx = reader.ReadSingle();
    73.                         float _posy = reader.ReadSingle();
    74.                         float _posz = reader.ReadSingle();
    75.  
    76.                         Vector3 _position = new Vector3(_posx, _posy, _posz);
    77.  
    78.                         BuildOther(senderID, _id, _playername, _playergender, _playerrace, _position, PlayerManager.Decompress(_umadata));
    79.                     }
    80.                 }
    81.             }
    82.         }
    83.  
    84.         private void BuildOther(int _senderID, int _id, string _playername, string _playergender, string _playerrace, Vector3 _position, byte[] _umadata)
    85.         {
    86.             GameObject GO = new GameObject("Player-" + _senderID.ToString());
    87.             GO.transform.position = _position;
    88.             PlayerOthers PO = GO.AddComponent<PlayerOthers>();
    89.  
    90.             PO.MakePlayer(_senderID, _id, _playername, _playergender, _playerrace, _umadata, _position);
    91.         }
    92.  
    93.         public void PlayerDisconnected(ushort ID)
    94.         {
    95.             GameObject GO = GameObject.Find("Player-" + ID.ToString());
    96.             Destroy(GO, 0.5f);
    97.         }
    98.     }
    99. }
    I am sorry for my English.

    Thank you very much for your help.
     
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    something is getting lost in the translation... :( could you try describing the situation again?
     
  3. SlyRipper

    SlyRipper

    Joined:
    Jun 19, 2012
    Posts:
    251
    Seems like you're losing _myPlayer in the script, but still try to access Properties of it (UserId) and it throws an error. You should check for if(_myPlayer != null) { do actions; } to prevent this. also you might want to try DontDestroyOnLoad(this); for your player so the game won't destroy your object throughout scenes.
     
  4. leorond

    leorond

    Joined:
    Mar 5, 2017
    Posts:
    8
    GameObject Player- (Network ID) is deleted if it moves other player connected in the game.

    The condition for _myPlayer did not help.
     
  5. leorond

    leorond

    Joined:
    Mar 5, 2017
    Posts:
    8
  6. SlyRipper

    SlyRipper

    Joined:
    Jun 19, 2012
    Posts:
    251
    The condition simply prevents that null reference error, so your game doesn't exit with an error, but keeps running. This might be desireable in some cases, for example if you just try to enter something and it doesn't work, so you can reset the player or whatever and re-try it. On the other hand the error would exit out your game, which is at some point annoying. But if there's something essential missing you would throw those errors to prevent further bugs that might get the players some advantages. (for example a object is missing that normally checks if the player is allowed to do something, and the player could enter that part, if it's missing)

    To your problem, it seems you don't have the player models on screen, and therefor no myPlayer Objects, but you need them to run your scripts, so you have to write a workaround to test your chat, or place those players in the scene to get the models. You might want to rethink your logic about that.
     
  7. leorond

    leorond

    Joined:
    Mar 5, 2017
    Posts:
    8
    Chat not work,
    Code (CSharp):
    1. writer.Write(userID);
    .
     
    Last edited: Mar 7, 2017
  8. leorond

    leorond

    Joined:
    Mar 5, 2017
    Posts:
    8
    The problem is in defining _myPlayer.
    But I do not know what.

    Code (CSharp):
    1.         private void Awake()
    2.         {
    3.             _myPlayer = GameObject.Find("Player").GetComponent<Player>();
    4.  
    5.             DarkRiftAPI.onDataDetailed += ReceiveData;
    6.             DarkRiftAPI.onPlayerDisconnected += PlayerDisconnected;
    7.             Player.onMyUmaReady += SendIamNew;
    8.         }
    9.  

    Code (CSharp):
    1.         private void SendIamNew()
    2.         {
    3.             if (DarkRiftAPI.isConnected)
    4.             {
    5.                 DarkRiftAPI.SendMessageToOthers(NT.StartT, NT.StartS.JoinGame, "HI JOE");
    6.  
    7.                 using (DarkRiftWriter writer = new DarkRiftWriter())
    8.                 {
    9.                     if (_myPlayer != null)
    10.                     {
    11.                         writer.Write(_myPlayer.UserID);
    12.                         writer.Write(_myPlayer.PlayerName);
    13.                         writer.Write(_myPlayer.PlayerGender);
    14.                         writer.Write(_myPlayer.PlayerRace);
    15.  
    16.                         writer.Write(_myPlayer.GetUMARecipe());
    17.                         writer.Write(_myPlayer.myPosition.x);
    18.                         writer.Write(_myPlayer.myPosition.y);
    19.                         writer.Write(_myPlayer.myPosition.z);
    20.                         DarkRiftAPI.SendMessageToOthers(NT.StartT, NT.StartS.Spawn, writer);
    21.                     }
    22.                     else
    23.                     {
    24.                         Debug.Log("[SendIamNew] _myPlayer == null");
    25.                     }
    26.                 }
    27.             }
    28.         }
    29.