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

can anyone help, it shows no mono behavior in unity when i look at the script

Discussion in 'Scripting' started by Chococraftt, Jun 9, 2020.

  1. Chococraftt

    Chococraftt

    Joined:
    Jun 9, 2020
    Posts:
    3
    can anyone help me with this, it shows no monobehavior scripts in the file names do not match the file name



    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class PlayerController : MonoBehaviour
    6. {
    7.     Camera cam;
    8.  
    9.     // Start is called before the first frame update
    10.     void Start()
    11.     {
    12.         cam = Camera.main;
    13.     }
    14.  
    15.     // Update is called once per frame
    16.     void Update()
    17.     {
    18.         if (Input.GetMouseButtonDown(0))
    19.         {
    20.             Ray ray = cam.ScreenPointToRay(Input.mousePosition);
    21.             RaycastHit hit;
    22.             if (Physics.Raycast(ray, out hit))
    23.             {
    24.                 Debug.Log("we hit" + hit.collider.name + " " + hit.point);
    25.                 //move our player to what we hit
    26.  
    27.                 //stop focusing on any object
    28.             }
    29.         }
    30.     }
    31. }
    32.  
     
  2. Chococraftt

    Chococraftt

    Joined:
    Jun 9, 2020
    Posts:
    3
    upload_2020-6-9_13-55-3.png
    shows this
     
  3. Nickp2905

    Nickp2905

    Joined:
    Jan 6, 2018
    Posts:
    4
    Hi, I'm not quite sure what you are expecting to see. To me its a standard PlayerController script. Have you attached it to your player and run Unity?
    Regards,
    Nick
     
  4. Chococraftt

    Chococraftt

    Joined:
    Jun 9, 2020
    Posts:
    3
    nvm i fixed it, it was problem with multiple files. thanks for ur reply anyways