Search Unity

Problem with Merry Fragmas part 2

Discussion in 'Multiplayer' started by MelvinTimpisCO, Mar 17, 2015.

  1. MelvinTimpisCO

    MelvinTimpisCO

    Joined:
    Mar 16, 2015
    Posts:
    1
    Hello I have a problem with Merry Fragmas part 2

    When im trying to enable the FirstPersonController with the PlayerNetworkMover.cs script I get the following error

    "The type or namespace name `FirstPersonController' could not be found. Are you missing a using directive or an assembly reference?"


    Code (CSharp):
    1. void Start ()
    2.     {
    3.         if(photonView.isMine)
    4.         {
    5.                 GetComponent<FirstPersonController> ().enabled = true;
    6.         }
    7. }
    I also tried to add namespace UnitySampleAssets.Characters.FirstPerson.FirstPersonController but then I get a new error saying

    "UnitySampleAssets.Characters.FirstPerson.FirstPersonController' is a `namespace' but a `type' was expected"

    Any help?
     
    Last edited: Mar 18, 2015
    MortePCAndVR likes this.
  2. MrSpanky

    MrSpanky

    Joined:
    Jan 18, 2015
    Posts:
    11
    I am having the same problem ;(
     
  3. Unknown86793241

    Unknown86793241

    Joined:
    Jun 5, 2010
    Posts:
    136
  4. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    The file FirstPersonController is in your project?
    If you use Unity 5, it might be that this is no longer a standard asset?
     
    Unknown86793241 likes this.
  5. Unknown86793241

    Unknown86793241

    Joined:
    Jun 5, 2010
    Posts:
    136
    I'm pretty sure that's all it is. Unity 5 has two new standard asset fps characters so the old code is calling a non existent component.
     
  6. MrSpanky

    MrSpanky

    Joined:
    Jan 18, 2015
    Posts:
    11
    I dont understand whats wrong :(

    My Player has the FirstPersonCharacter script attached to it. Then I add the PlayerNetworkMover.cs script which is supposed to re enable the FirstPersonCharacter script using the line

    "GetComponent<FirstPersonController>().enabled=true;"

    And gives me the error "The type or namespace name `FirstPersonController' could not be found. Are you missing a using directive or an assembly reference?"

    Same problem is both unity 5 and 4.

    Can someone explain why GetComponent isnt able to find the FirstPersonController script on my player? It doesnt make any sense to me
     
  7. Unknown86793241

    Unknown86793241

    Joined:
    Jun 5, 2010
    Posts:
    136
    Is it FirstPersonCharacter or FirstPersonController ?
     
  8. MrSpanky

    MrSpanky

    Joined:
    Jan 18, 2015
    Posts:
    11
    The script is called FirstPersonController.cs and is included in the new fpscontroller for unity 5
     
    tobiass likes this.
  9. Unknown86793241

    Unknown86793241

    Joined:
    Jun 5, 2010
    Posts:
    136
    I think whats missing is........

    Code (CSharp):
    1. namespace UnityStandardAssets.Characters.FirstPerson {
    2. //code
    3. }
    on the network mover script.

    You might have to add it to the network manager as well.
     
    Last edited: Apr 4, 2015
    MortePCAndVR likes this.
  10. jillmitchell100

    jillmitchell100

    Joined:
    Mar 1, 2014
    Posts:
    8
  11. MortePCAndVR

    MortePCAndVR

    Joined:
    Jul 21, 2013
    Posts:
    14
    Both morpmorpmorp & Unknown86793241 's responses above are correct in that appropriate namespace wrappers for the FPS Controller being used in our projects need to be added around the class definition in PlayerNetworkMover.cs
    & also NetworkManager.cs to fix the call to type <PlayerNetworkMover> in the statement below:
    player.GetComponent<PlayerNetworkMover> ().RespawnMe += StartSpawnProcess;

    - morpmorpmorp's link to abhijeet1001's solution works for what appears to be a SAMPLE Asset-based FPS Controller
    - Unknown86793241's solution works for the new Unity v5/v5.1 STANDARD Asset-based FPS Controller.


    It depends on which FPS Controller you have imported to your project.
    (Hats off to abhijeet1001 for using the prop_sciFiGun_low rather than the candycane! Great minds thinking alike there...)


    I'm way more worried about this warning in Unity v5:
    "Assets/Photon Unity Networking/Editor/PhotonNetwork/PhotonEditor.cs(641,46): warning CS0618: `UnityEngine.RPC' is obsolete: `NetworkView RPC functions are deprecated. Refer to the new Multiplayer Networking system.'"


    Need another LiveTraining PUN prototype for Unity 5 I guess...
     
    Last edited: Jun 26, 2015