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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How do i use this with the UFPS Character Controller?

Discussion in 'Scripting' started by bonersoup, Jun 1, 2015.

  1. bonersoup

    bonersoup

    Joined:
    Nov 11, 2013
    Posts:
    18
    Assets/Building Models/F***ingTree/RayCastChop.js(6,26): BCE0018: The name 'PlayerControl' does not denote a valid type ('not found').
    I get this error will post if i figure it out...
    Code (JavaScript):
    1. #pragma strict
    2.  
    3. var rayLength : int = 10;
    4.  
    5. private var treeSript : TreeController;
    6. private var playerAnim : PlayerControl;
    7.  
    8. function Update()
    9. {
    10.     var hit : RaycastHit;
    11.     var fwd = transform.TransformDirection(Vector3.forward);
    12.  
    13.         if(Physics.Raycast(transform.position, fwd, hit, rayLength))
    14.         {
    15.             if(hit.collider.gameObject.tag == "Tree")
    16.             {
    17.                 treescript = GameObject.Find(hit.collider.gameObject.name).GetComponent(TreeController);
    18.                 playerAnim = GameObject.Find("MedevilHero").GetComponent(PlayerControl);
    19.    
    20.                 if(Input.GetButtonDown("Fire1") && playerAnim.canSwing == true)
    21.                 {
    22.                     treeScript.treeHealth -= 1;
    23.                 }
    24.             }
    25.         }
    26.     }    
     
  2. bonersoup

    bonersoup

    Joined:
    Nov 11, 2013
    Posts:
    18
    Assets/InventorySystem/RayCastTree.js(7,26): BCE0018: The name 'PlayerControl' does not denote a valid type ('not found').
    still getting this any ideas?
     
  3. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    that error basically means you don't have a class by the name "PlayerControl" anywhere in your project. Check the names, is it "PlayerController"? or even "Playercontrol"? has to be exact.