Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by AdmiralTNT · Jan 10, 2018 at 09:46 PM · cs1061

Trouble wth Error CS1061

I'm brand new to Unity, and I was following a tutorial on how to make a camera smoothly follow an object. An error popped up and after I fixed it another error popped up that said "Type UnityEngine.Transform' does not contain a definition for lookAt' and no extension method lookAt' of type UnityEngine.Transform' could be found. Are you missing an assembly reference?" Being a noob, I have no idea what that means. Here's the script:

 using UnityEngine;
 
 public class CameraFollow : MonoBehaviour {
 
     public Transform target;
     public Vector3 smoothedPosition;
     public float smoothSpeed = 0.125f;
     public Vector3 offset;
 
     void LateUpdate ()
     {
         Vector3 desiredPosition = target.position + offset;
         Vector3 smootedPosition = Vector3.Lerp (transform.position, desiredPosition, smoothSpeed*Time.deltaTime);
         transform.position = smoothedPosition;
     
         transform.lookAt (target);
     }
 
 }
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by KittenSnipes · Jan 10, 2018 at 10:31 PM

@AdmiralTNT Well there is only one thing wrong. The last line of your code should be this:

 transform.LookAt(target);
 

Instead of this:

 transform.lookAt(target);

Also @ransomink is right you call a Vector3 called smoothedPosition but never use it. Then you call another Vector3 with the same name. So instead you should put:

 smoothedPosition = Vector3.Lerp (transform.position, desiredPosition, smoothSpeed*Time.deltaTime);

In place of:

 Vector3 smootedPosition = Vector3.Lerp (transform.position, desiredPosition, smoothSpeed*Time.deltaTime);

The only difference is the L is capital but that is Unity's function so you must be case sensitive when typing it. You need to work on being case sensitive because that can make or break your code.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by ransomink · Jan 10, 2018 at 10:39 PM

Make sure to check the Unity API, especially if you are new to coding. It should be transform.LookAt(); with a capital L, not lowercase.


What IDE are you using, Monodevelop or VisualStudio? It should be able to tell you if variables are spelled incorrectly. In this line: Vector3 smootedPosition = Vector3.Lerp (transform.position, desiredPosition, smoothSpeed*Time.deltaTime); you create a variable called smootedPosition but in the next line use a different variable smoothedPosition to set your transform. smoothedPosition is never set to anything to begin with.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

75 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

CS 1501 and 1061 appear and says No overload for method `Box' takes `1' arguments 1 Answer

Error with raycast 0 Answers

Changing variable of another object (C#) 1 Answer

Error CS1061 on Mac 0 Answers

Prime31 Social Networking error cs1061 and cs 1579 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges