get player object in scene

Options
2»

Answers

  • AxReal
    Options
    no! if i kill other player, it enable shield on me! and only on my pc! i need to enable shield on new spawned players in room for all PCs!
  • mau
    mau
    edited July 2016
    Options
    I'm not sure i understand what you need but, you can use the OnPhotonInstantiate() function to execute something when the GameObject is instantiated. For example:
    public void OnPhotonInstantiate(PhotonMessageInfo info)
    {
    	if (info.sender.isLocal)
    		shield(info.sender.ID, 3f);
    }
    
    IEnumerator shield(int id, float time)
    {
    	//Send RPC to enable THIS player's shield
    	yield return new WaitForSeconds(time);
    	//Send RPC to disable THIS player's shield
    	yield return 0;
    }