• 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 R1pnd1p · Oct 19, 2013 at 08:23 AM · multiplayerphotonnetwork.destroy

destroying an object with a specific viewid, photonnetwork.

i want to destroy an object with a specific view ID, i can get the view id from a collision, now i want to use it in order to destroy that specific gameobject. (the gameobject is a player). this is my attempt.

     [RPC] void OnCollisionEnter (Collision collision) {
         //Destroy (GameObject);
         if(collision.gameObject){
             //this is all failed attempts to try to do this..
             int denis = collision.contacts[0].otherCollider.GetComponent<PhotonView>().viewID;
             PhotonNetwork.Destroy (photonView.viewID (denis));
             
             
             
             Debug.Log ("view id of hit:" + denis);

thanks in advance!

Comment
Add comment · Show 1
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
avatar image vanshika1012 · Mar 28, 2016 at 01:49 PM 0
Share

I am facing the same problem. Can you please help me? @R1pnd1p

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by R1pnd1p · Mar 06, 2017 at 02:19 PM

It requires the use of RPC calls, I wrote this question in 2013, that project will not get revived....ever again.

Comment
Add comment · Share
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
avatar image
0

Answer by michi112 · Mar 05, 2017 at 03:26 PM

Use a function that get called for everybody like my

Calling it like mainPhotonView.RPC("Destroy", photontarget.all, 1001); // exampl

[PunRPC] Void Destroy(int viewID) { Destroy(PhotonView.Find(viewID).gameObject); }

Comment
Add comment · Share
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

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

18 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

Related Questions

Photon Unity - Player tag 0 Answers

Unity networking tutorial? 6 Answers

Problem with UFPS and photon 1 Answer

photon player freak out! 1 Answer

Photon Networking - What function(s) are called when a player (not me) is spawned? 2 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges