Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by itsmezami · Aug 03, 2021 at 02:36 AM · networkingphotonrpc

photonView with ID 2 has no method "deleteBot" marked with the [PunRPC](C#) or @PunRPC(JS) property! Args: | but i've already put my photon in

heyy im currently following a tutorial from youtube and i got a problem when i press delete button it says something like my question, can someone give me any clue ? thanks!

 using UnityEngine;
 using System.Collections;
 
 public class roomMan : Photon.MonoBehaviour {
 
     public string verNum = "0.1";
     public string roomName = "room01";
     public string playerName = "player 420";
     public Transform spawnPoint;
     public GameObject playerPref;
     public GameObject playerPref2;
     public bool isConnected = false;
     public bool isInRoom = false;
     public GameObject[] Ais;
     public GameObject[] curAis;
     public int kD;
 
 
 
     public InRoomChat chat;
 
     public Transform[] spawnPoints;
 
 
     void Update(){
         if (isInRoom) {
             chat.enabled = true;
         } else {
             //chat.enabled = false;
         }
 
         curAis = GameObject.FindGameObjectsWithTag ("Ai");
 
         if (Input.GetKeyDown (KeyCode.E) && isInRoom == false) {
             spawnAi ();
         }
         if (PlayerPrefs.GetInt ("kills") >= 1) {
             kD = PlayerPrefs.GetInt ("kills") / PlayerPrefs.GetInt ("deaths"); 
         } else {
             kD = 0;
         }
 
         PhotonNetwork.player.SetScore (PlayerPrefs.GetInt ("kills"));
     }
 
     void Start(){
 
         roomName = "Room " + Random.Range (0, 999);
         playerName = "Player " + Random.Range (0, 999);
         PhotonNetwork.ConnectUsingSettings (verNum);
         Debug.Log ("Starting Connection!");
 
         
         //PlayerPrefs.SetInt ("kills", 0);
         //PlayerPrefs.SetInt ("deaths", 0);
 
     }
 
     public void OnJoinedLobby(){
         //PhotonNetwork.JoinOrCreateRoom (roomName, null, null);
         isConnected = true;
         Debug.Log ("Starting Server!");
     }
 
     public void OnJoinedRoom(){
         PhotonNetwork.playerName = playerName;
 
         GameObject[] players = GameObject.FindGameObjectsWithTag ("Player");
         foreach(GameObject pl in players){
             if(pl.name == PhotonNetwork.playerName){
                 PhotonNetwork.playerName = playerName + " " + Random.Range (0,999);
             }
         }
 
 
         isConnected = false;
         isInRoom = true;
         //spawnPlayer ();
     }
 
 
     public void spawnPlayer(string prefName){
         isInRoom = false;
 
         GameObject[] players = GameObject.FindGameObjectsWithTag ("Player");
 
         foreach(PhotonPlayer pl2 in PhotonNetwork.playerList){
             if(pl2.name == PhotonNetwork.playerName){
                 PhotonNetwork.playerName = playerName + " " + Random.Range (0,999);
             }
         }
 
 
         GameObject pl = PhotonNetwork.Instantiate (prefName, spawnPoints[Random.Range (0, spawnPoints.Length)].position, spawnPoint.rotation, 0) as GameObject;
         pl.GetComponent<RigidbodyFPSWalker> ().enabled = true;
         pl.GetComponent<RigidbodyFPSWalker> ().fpsCam.SetActive (true);
         pl.GetComponent<RigidbodyFPSWalker> ().graphics.SetActive (false);
         
     }
 
     public void spawnAi(){
         GameObject ai1 = PhotonNetwork.Instantiate (Ais[Random.Range(0,Ais.Length)].name, spawnPoints[Random.Range (0, spawnPoints.Length)].position, spawnPoint.rotation, 0) as GameObject;
         ai1.GetComponent<aiCon> ().isMine = true;
 
     }
 
     void OnGUI(){
 
         if (isConnected) {
             Cursor.visible = true;
             Cursor.lockState = CursorLockMode.None;
             GUILayout.BeginArea (new Rect (Screen.width / 2 - 250, Screen.height / 2 - 250, 500,500));
             playerName = GUILayout.TextField (playerName);
             roomName = GUILayout.TextField (roomName);
 
             if (GUILayout.Button ("Create")) {
                 PhotonNetwork.JoinOrCreateRoom (roomName, null, null);
             }
 
             foreach (RoomInfo game in PhotonNetwork.GetRoomList()) {
                 if (GUILayout.Button (game.name + " " + game.playerCount + "/" + game.maxPlayers)) {
                     PhotonNetwork.JoinOrCreateRoom (game.name, null, null);
                 }
             }
             GUILayout.EndArea ();
         }
 
         if (isInRoom) {
             Cursor.visible = true;
             Cursor.lockState = CursorLockMode.None;
             GUILayout.BeginArea (new Rect (Screen.width / 2 - 250, Screen.height / 2 - 250, 500,500));
             GUILayout.Box("Score: " + PhotonNetwork.player.GetScore () + " \n \nBots: x" + curAis.Length + "\n");
             GUILayout.Box("Kills: " + PlayerPrefs.GetInt ("kills") + " | "  + "Deaths: " + PlayerPrefs.GetInt ("deaths") + " | K/D: " + kD)  ;
 
 
 
             if (GUILayout.Button ("Assault")) {
                 spawnPlayer(playerPref2.name);
             }
             if (GUILayout.Button ("SWAT")) {
                 spawnPlayer(playerPref.name);
             }
             if (GUILayout.Button ("Disconnect")) {
                 PhotonNetwork.Disconnect ();
                 Application.LoadLevel (0);
             }
             if (GUILayout.Button ("Spawn 2 Bots")) {
                 spawnAi ();
                 spawnAi ();
             }
             if (GUILayout.Button ("Delete Bot")) {
                 GameObject.Find("_NETWORKSCRIPTS").GetComponent<PhotonView>().RPC("deleteBot", PhotonTargets.AllBuffered, null);
             }
             GUILayout.EndArea ();
         }
     }
 }
 
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

173 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Proper way to instantiate projectile in PUN 1 Answer

Photon/Network - Killing A Client Enemy Unit 3 Answers

Photon (PUN) Type Serialization Error on RPC 2 Answers

Experience going to both players, Photon Unity Networking 0 Answers

Synchronize array with simultaneous access via Photon Network RPC 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges