- Home /
merry fragmas part 2 PlayerNetworkMover Script errors
Hi there i am facing some problems i am trying to follow the tutorial step by step , i have unity 4.6 so stuff is bit different but understandable i face some tiny issues with scripts in character movement in part 1 but i managed it with almost no hard work but now in part to really having hard time the things mike disabled in the part 2 i cant find same things so i disable things i thght are the ones we need to disable like character control , first person controller etc etc , but when i try to make script so i can enable them and do
GetComponent<FirstPersonController> ().enabled = true;
my intellisense doesnt shows anything and i even get error when trying to run it saying there is nothing like FirstPersonController ? please help also things like head bob isnt a different thing anymore its under firtperson controller so probably disable it and enabling it wuld handle head bob too right ?
Should that be FirstPersonCharacter ?? not FirstPersonShooter
Was that the problem ? I had a look at the code posted on the same page as the video.
no it doesnt solves my problem , the unity 4.6 has differnt gui stuff so i am not sure what to enable via script and what not to as in video mike disabled many stuff like head bob , mouse rotator , character controller , etc etc but i dont have same things like i cant find mouse rotator at all , i found character controller and a script FirstPersonController i can disable them but when i try to enable it via script it doesnt work if i try to get the script by doing
GetComponent{FirstPersonController}() ( added those { } cause wasnt able to post < in comment )
nothing shows up in intellisense while i am typing firstpersoncontroller nor it works in game and gives me compiler error if i just write that thing and save the script n try to play game
@kdub also the video is of older version of unity ( slight old ) i have unity 4.6 and new sample assests so things are different
Answer by abhijeet1001 · Jan 10, 2015 at 02:14 AM
FOUND THE ANSWER oh god thank god my brain worked or else who wuld have helped me ~_~ this community is sleepy :v , wel for anyone who is stuck like i was use namespace
using UnityEngine;
using System.Collections;
namespace UnitySampleAssets.Characters.FirstPerson{
public class PlayerNetworkMover : Photon.MonoBehaviour {
// Use this for initialization
void Start ()
{
GetComponent<CharacterController> ().enabled = true;
GetComponent<FirstPersonController> ().enabled = true;
GetComponentInChildren<PlayerShooting> ().enabled = true;
foreach(Camera cam in GetComponentsInChildren<Camera>())
cam.enabled = true;
// transform.Find("Head Joint/First Person Camera/GunCamera/prop_sciFiGun_low").gameObject.layer = 11;
}
// Update is called once per frame
void Update () {
}
}
}
Thank you Thank you Thank you
This has been frustrating me for weeks and I was ready to pack it in..
Oh thanks man. I was in the same situation as you were. Thanks for posting the solution. A big help. How you managed to do the "Character $$anonymous$$ovement", can you post the script for it? I am confused there.
Thank you! Crosslinking back to forum with related info: http://forum.unity3d.com/threads/problem-with-merry-fragmas-part-2.311481/
The correct namespace to use depends on where you get the FPS Controller from - SA$$anonymous$$PLE Assets, or STANDARD Assets, or wherever...
I had to use namespace UnityStandardAssets.Characters.FirstPerson { for Unity v5.1 standard asset FPS Controller.
Answer by wmadwand · Nov 30, 2015 at 03:21 PM
In addition, instead
namespace UnitySampleAssets.Characters.FirstPerson
you can use
using UnitySampleAssets.Characters.FirstPerson;
It works well in the same way. So you can choose what remedy to take in this case :)