Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Need help with script

Discussion in 'Scripting' started by DeezzzNuts, Nov 30, 2019.

  1. DeezzzNuts

    DeezzzNuts

    Joined:
    Nov 30, 2019
    Posts:
    1
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.UI;

    public class PickUpPistol : MonoBehaviour {

    public float TheDistance;
    public GameObject ActionDisplay;
    public GameObject ActionText;
    public GameObject FakePistol;
    public GameObject RealPistol;
    public GameObject GuideArrow;
    public GameObject ExtraCross;

    void Update () {
    TheDistance == PlayerCasting.DistanceFromTarget;
    }

    I am trying to create a pistol pickup script theres other code but I think that is unnecessary this is the console error:
    Assets\Scripts\Sequences\PickUpPistol.cs(17,24): error CS0103: The name 'PlayerCasting' does not exist in the current context
     
  2. AlexN2805

    AlexN2805

    Joined:
    Nov 27, 2019
    Posts:
    33
    Well.. you haven't defined PlayerCasting. What is it? Where is it in your code?
     
  3. Mr_Crispy

    Mr_Crispy

    Joined:
    Dec 5, 2019
    Posts:
    2
    I'm assuming that's the script from the Jimmy Vegas coding tutorial (it looks similar) PlayerCasting is a script which was created in one of the earlier episodes which you haven't added because you probably skipped the video, go to the raycasting episode and write a PlayerCasting script!
     
  4. Mr_Crispy

    Mr_Crispy

    Joined:
    Dec 5, 2019
    Posts:
    2
    Or just write your own PlayerCasting script!