Search Unity

Methods does not work properly

Discussion in 'Scripting' started by brkbkc, Sep 9, 2019.

  1. brkbkc


    Jan 28, 2019
    Hello, i am developing an online card game. For networking i used Photon Network system in the game. Network data transfers working well. I am sending objects name to other player by RPC.
    receiving player gets the name of object and finds object by using "GameObject.Find". It s also working fine.
    I m trying to destroy the object which i found, it sometimes destroys and sometimes not. I also tried to change objects parent to another same problem again. Sometimes functions work and sometimes not.

    I am sending datas by using this function.
    Code (CSharp):
    1. pv.RPC("gelenDataIsle", PhotonTargets.Others, sendingData);
    I am receiving datas by using this function.
    Code (CSharp):
    1. public void gelenDataIsle(string dataGelen)
    2. {
    3. string[] rawString = dataGelen.Split(':'); //dividing data
    4. if (rawString[0] == "cekilenKart")
    5. {
    6.       GameObject card = GameObject.Find(rawString[1]);
    7.       Destroy (card.gameobject);
    8. }
    9. }
    Any help please.

    That was my mistake. There are 2 GameObject having the same name.
    Last edited: Sep 9, 2019