Hey Guys. Iam pretty new into C# and I am just about to learn how to disable a script when something else is happening. so, currently iam working on a “place an object on a plane” script. some kind of orcs must die stuff.
so i have my third person controlled character and when he places an object he should not be able to move arround. so baisically i just need to disable the “ThirdPersonController”. but i have an error that says that The name does not exist in the current context
here ist the code snippet. the Disable ThirdPersonController Part is on line 32:
using UnityEngine;
using System.Collections;
public class BuildingPlacement : MonoBehaviour {
public float scrollSensitivity;
private PlaceableBuilding placeableBuilding;
private Transform currentBuilding;
private bool hasPlaced;
public LayerMask buildingsMask;
public LayerMask groundMask;
private PlaceableBuilding placeableBuildingOld;
public float speed = 30;
// Update is called once per frame
void Update () {
RaycastHit hit = new RaycastHit();
Ray ray = camera.ScreenPointToRay (Input.mousePosition);
Physics.Raycast(ray,out hit, Mathf.Infinity, groundMask);
Vector3 m = Input.mousePosition;
m = new Vector3(m.x,m.y,transform.position.y);
Vector3 p = camera.ScreenToWorldPoint(m);
if (currentBuilding != null && !hasPlaced){
Player.GetComponent("ThirdPersonController").enabled = false;
//more stuff is comming here but thats not important i guess..
(the GameObject that contains the ThirdPersonController is called Player with a Tag that also called Player)
would be great if you have a look over and help me out with that