Search Unity

The type or namespace could not be found:s

Discussion in 'Editor & General Support' started by lynxlewis, Nov 27, 2012.

Thread Status:
Not open for further replies.
  1. lynxlewis

    lynxlewis

    Joined:
    Nov 27, 2012
    Posts:
    5
    Hey everyone, So I should probably start by saying i'm extremely new to unity, so there's a chance this is something very simple... But I have something that I've coded, all it's meant to do is send some variables to a php file, however I'm getting an error and i'm really not sure why, and google hasn't proved much use:S

    Here's my code
    Code (csharp):
    1. using UnityEngine;
    2.  
    3. public class PostURL : MonoBehaviour {
    4.  
    5.     void Start () {
    6.         var pos = Vector3;
    7.         var user = database.userr;
    8.         string url = "http://www.website.com/storepos.php";
    9.         WWWForm form = new WWWForm();
    10.         form.AddField("position", pos);
    11.         form.AddField("user", user);
    12.         WWW www = new WWW(url, form);
    13.  
    14.         StartCoroutine(WaitForRequest(www));
    15.     }
    16.  
    17.     IEnumerator WaitForRequest(WWW www){
    18.         yield return www;
    19.  
    20.         // check for errors
    21.         if (www.error == null)
    22.         {
    23.             Debug.Log("WWW Ok!: " + www.data);
    24.         } else {
    25.             Debug.Log("WWW Error: "+ www.error);
    26.         }    
    27.     }    
    28. }
    The error I'm getting is :
    So I assume the error is on line 17?

    Googling that error hasn't gave me any luck however, Any help would be much appreciated guys, Really quite stuck here o.0, Thanks very much in advance.
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    If that's what it actually says, then you made a typo in your code there. Although that's not in the code you posted.

    --Eric
     
  3. jhoemar

    jhoemar

    Joined:
    Nov 28, 2012
    Posts:
    11
    At line 17 seems to be correct! Please check the compiler outputs for futher error.

    -Jhoemar
     
  4. lynxlewis

    lynxlewis

    Joined:
    Nov 27, 2012
    Posts:
    5
    Ah I didn't copy the error I typed it, The error is the same minus the typo, and the output is just as follows:

    :/ any ideas?
     
  5. Joseph-Ferano

    Joseph-Ferano

    Joined:
    Jul 18, 2008
    Posts:
    165
    You seem to be missing this;

    using System.Collections;

    Put that at the top.
     
  6. 121Gamers

    121Gamers

    Joined:
    Jan 7, 2014
    Posts:
    6
    Can someone help i know im a noobe lol
    Trying to add photon multilayer with spawn respawn on die Can any legend see the problem
    I get this error everything else works fine
    Assets/Photon Unity Networking/UtilityScripts/NetworkManager.cs(7,9): error CS0246: The type or namespace name `spawn' could not be found. Are you missing a using directive or an assembly reference?
     
  7. Rockyxx5

    Rockyxx5

    Joined:
    Jun 1, 2014
    Posts:
    4
    You are a life saver
     
    coder9401 likes this.
  8. Kazekage

    Kazekage

    Joined:
    Jul 9, 2015
    Posts:
    1
    Thanks! I had the same error and this fixed it for me as well! =)
     
    coder9401 likes this.
  9. coder9401

    coder9401

    Joined:
    Dec 20, 2020
    Posts:
    1
    Almost 6 years later, you helped me too :)
     
  10. MercuryHg_mhg

    MercuryHg_mhg

    Joined:
    May 4, 2021
    Posts:
    1
    i dont know what to say you saved my life
     
  11. PlayGGmateDev

    PlayGGmateDev

    Joined:
    Dec 25, 2022
    Posts:
    1
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class MovementScript : MonoBehaviour
    6. {
    7.     public bool isMoving = false;
    8.     public float movementSpeed = 20f;
    9.     public RigidBody rb;
    10.     public float jumpAmount = 10f;
    11.     public float rage = 1f;
    12.     public bool grounded = false;
    13.     public Camera GroundedCam;
    14.     public float horizontalSpeed = 1.0f;
    15.     float v;
    16.  
    17.     // Start is called before the first frame update
    18.     void Start()
    19.     {
    20.         Cursor.lockState = Cursor.LockMode.Locked;
    21.      
    22.     }
    23.  
    24.     // Update is called once per frame
    25.     void Update()
    26.     {
    27.         if (Input.GetKey(KeyCode.W))
    28.         {
    29.             transform.position += transform.forward * Time.deltaTime * movementSpeed;
    30.         }
    31.  
    32.         if (Input.GetKey(KeyCode.S))
    33.         {
    34.             transform.position -= transform.forward * Time.deltaTime * movementSpeed;
    35.         }
    36.  
    37.         if (Input.GetKey(KeyCode.D))
    38.         {
    39.             transform.position += transform.forward * Time.deltaTime * movementSpeed;
    40.         }
    41.  
    42.         if (Input.GetKey(KeyCode.A))
    43.         {
    44.             transform.position -= transform.forward * Time.deltaTime * movementSpeed;
    45.         }
    46.  
    47.         ShootRaycast();
    48.  
    49.         if (Input.GetKeyDown(KeyCode.Space) & grounded == true)
    50.         {
    51.             rb.AddForce(Vector3.up * jumpAmount, ForceMode.Impulse);
    52.         }
    53.  
    54.         float h = horizontalSpeed * Input.GetAxis("Mouse X");
    55.         transform.Rotate(v, h, 0);  
    56.     }
    57.  
    58.     void ShootRaycast()
    59.     {
    60.         RaycastHit hit;
    61.         if (Physics.Raycast(GroundedCam.transform.position, GroundedCam.transform.forward, out hit, range))
    62.         {
    63.             Debug.Log(hit.transform.name);
    64.  
    65.             Target target = hit.transform.GetComponent<Target>();
    66.             if(target != null)
    67.             {
    68.                 StartCoroutine(JumpBool());
    69.             }
    70.         }
    71.     }
    72.  
    73.     IEmumerator JumpBool()
    74.     {
    75.         grounded = true;
    76.         yield return new WaitForSeconds(0.1f);
    77.         grounded = false;
    78.     }
    79.  
    80. }
    81.  
    Nothing was missing then this happened

    Assets\Scenes\MovementScript.cs(9,12): error CS0246: The type or namespace name 'RigidBody' could not be found (are you missing a using directive or an assembly reference?)
    I dont know whats missing
     
  12. BABIA_GameStudio

    BABIA_GameStudio

    Joined:
    Mar 31, 2020
    Posts:
    497
    Nothing is missing. You have just spelled Rigidbody incorrectly.
    Capitalisation matters. If in doubt, look at the manual and you will see how you have typed it wrong.

    Also you should not be necroing a topic for this, when you should be creating your own topic.
     
  13. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,456
    Please create your own threads, don't necro/hijack others.
     
Thread Status:
Not open for further replies.