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. Dismiss Notice

Functions not working. missing assembly?

Discussion in 'Scripting' started by darthkrickets, Oct 12, 2020.

  1. darthkrickets

    darthkrickets

    Joined:
    Oct 12, 2020
    Posts:
    2
    Hi,

    I am following along with a youtube video by Brackeys about making a first person controller and some of my script is not working.
    Firstly, in Visual Studio functions like Transform arent even being highlighted as if they arent part of any repository. Im getting an error:

    Assets\Scripts\PlayerLook.cs(28,19): error CS1061: 'Transform' does not contain a definition for 'localRoatation' and no accessible extension method 'localRoatation' accepting a first argument of type 'Transform' could be found (are you missing a using directive or an assembly reference?)

    So I downloaded Unity 2020 through the hub last night, the only thing I added myself was .NET core 3.1.
    Visual Studio does contain the unity tools extension.

    What else should I have downloaded? I have most recent .NET framework.
    Or what program should I set as default for scripting with .cs?

    for reference here is my script:
    (my apologies, I dont know how to get line numbers)

    using System;
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class Player : MonoBehaviour
    {
    public float mouseSensitivity = 100f;
    public Transform playerBody;
    float xRotation = 0f;
    // Start is called before the first frame update
    void Start()
    {
    Cursor.lockState = CursorLockMode.Locked;
    }
    // Update is called once per frame
    void Update()
    {
    float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
    float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;
    xRotation -= mouseY;
    xRotation = Mathf.Clamp(xRotation, -90f, 90f);
    transform.localRoatation = Quaternion.Euler(xRotation, 0f, 0f);
    playerBody.Rotate(Vector3.up * mouseX);
    }
    }
     
  2. TheOtherUserName

    TheOtherUserName

    Joined:
    May 30, 2020
    Posts:
    136
    You wrote localRoatation instead of localRotation. Just one a too much but it can ruin your day, right? Anyway I hope it helped and please use the code brackets when pasting code the next time
     
  3. darthkrickets

    darthkrickets

    Joined:
    Oct 12, 2020
    Posts:
    2
    Yeah, that did it. thanks!
     
  4. TheOtherUserName

    TheOtherUserName

    Joined:
    May 30, 2020
    Posts:
    136
    Np I'm happy to help