Access to collider photonView

Options
marf
marf
Hi, i'm using this script to send the damage to a player:

void OnCollisionEnter(Collision other){

// ....

}

Now what I need to do to access to other.gameObject.photonView for example?

Thanks a lot,

Marco

Comments

  • dreamora
    Options
    there is no photonView as this is not a unity class (these .xxxx are all only properties in the end)
    you have to use GetComponent<PhotonView>() instead (which is what networkView internally does for NetworkView for example)
  • marf
    Options
    Ok, thanks a lot, now I start a new project, but when I import the Photon Unity Networking it says:

    Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs(35,93): error CS0117: `Path' does not contain a definition for `GetFileNameWithoutExtension'

    I don't edit it, this is the code:
    // --------------------------------------------------------------------------------------------------------------------
    // &lt;copyright file="PhotonNetwork.cs" company="Exit Games GmbH"&gt;
    //   Part of: Photon Unity Networking
    // &lt;/copyright&gt;
    // --------------------------------------------------------------------------------------------------------------------
    
    using System.Collections;
    using System.Collections.Generic;
    using System.IO;
    
    using ExitGames.Client.Photon;
    using UnityEngine;
    
    /// &lt;summary&gt;
    /// The main class to use the PhotonNetwork plugin.
    /// This class is static.
    /// &lt;/summary&gt;
    public static class PhotonNetwork
    {
        /// &lt;summary&gt;
        /// This Monobehaviour allows Photon to run an Update loop.
        /// &lt;/summary&gt;
        public static readonly PhotonHandler photonMono;
    
        /// &lt;summary&gt;
        /// Our photon class
        /// &lt;/summary&gt;
        public static readonly NetworkingPeer networkingPeer;
    
        /// &lt;summary&gt;
        /// The maximum amount of assigned networkviews PER player (or scene). See the documentation on how to raise this limitation
        /// &lt;/summary&gt;
        public static readonly int MAX_VIEW_IDS = 1000; // VIEW & PLAYER LIMIT CAN BE EASILY CHANGED, SEE DOCS
    
        public static ServerSettings PhotonServerSettings = (ServerSettings)Resources.Load(Path.GetFileNameWithoutExtension(NetworkingPeer.serverSettingsAssetPath), typeof(ServerSettings));
    

    I don't know where is the error, it's very strange!
  • dreamora
    Options
    you are on the wrong platform.
    Ensure its a windows, osx, iOS or Android project
  • marf
    Options
    Thank you.
  • i have the same problem when i changed files but with the same projects