Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 iDesign · Aug 21, 2012 at 01:33 AM · animationlerpz

Lerpz Animation, Not Connected??

I Set the Third Person Player Animation (Script) to The Player Tab and when i click the "play" button, the screen zooms onto Lerpz but i can't control him, just the camera of the screen
This is the error message that comes up:

MissingComponentException: There is no 'Animation' attached to the "Player" game object, but a script is trying to access it. You probably need to add a Animation to the game object "Player". Or your script needs to check if the component is attached before using it. ThirdPersonPlayerAnimation.Update () (at Assets/Scripts/Player/ThirdPersonPlayerAnimation.js:69)

I checked line 69 of the script but all it showed was a { . Could anyone tell me how to fix this?

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

3 Replies

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

Answer by iDesign · Aug 21, 2012 at 08:02 PM

-Help was very appreciated Charles-

  1. I dragged the Lerpz prefab to the Hierarchy

  2. I downloaded the Lerpz prefab from the Unity Sites Tutorial

  3. When i play the game the Camera Zooms in from far onto Lerpz then instead of controlling Lerpz himself, i control the camera. The capsule collider is well placed at 1.03 "y" around Lerpz.

  4. Here is the Script at 69:

          {
                 ApplyPositionDamping (Vector3(targetCenter.x, targetHeight, targetCenter.z));
             }
             
             SetUpRotation(targetCenter, targetHead);
         }
         
         function ApplySnapping (targetCenter : Vector3)
         {
             var position = transform.position;
             var offset = position - targetCenter;
             offset.y = 0;
             var currentDistance = offset.magnitude;
         
             var targetAngle = target.eulerAngles.y;
             var currentAngle = transform.eulerAngles.y;
         
             currentAngle = Mathf.SmoothDampAngle(currentAngle, targetAngle, velocity.x, snapLag);
             currentDistance = Mathf.SmoothDamp(currentDistance, distance, velocity.z, snapLag);
         
             var newPosition = targetCenter;
             newPosition += Quaternion.Euler(0, currentAngle, 0) * Vector3.back * currentDistance;
         
             newPosition.y = Mathf.SmoothDamp (position.y, targetCenter.y + height, velocity.y, smoothLag, maxSpeed);
         
             newPosition = AdjustLineOfSight(newPosition, targetCenter);
             
             transform.position = newPosition;
             
             // We are close to the target, so we can stop snapping now!
             if (AngleDistance (currentAngle, targetAngle) < 3.0)
             {
                 isSnapping = false;
                 velocity = Vector3.zero;
             }
         }
    
    

Do you think there might be a problem with the target height? Anyway i hope this helps

Comment
Add comment · Show 1 · 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 CharlesD · Aug 23, 2012 at 05:24 AM 0
Share

Hmmm... Very Strange, I would first check to ensure you placed the components on their correct gameObjects. Usually when one object behaves the way another should it means a script was accidentally placed on the wrong gameObject or that the wrong parameter was given to a script. For instance a script may require the transform of the player, but any Transform can be dragged into the script. So my second suggestion would be to check if the tutorial asked you to drag an object from the hierarchy to a place on a script that you dragged the right object to the right place. At the moment it sounds like the script for controlling the player is somehow manipulating the camera transform rather than the player's so either the script that handles player motion is on the wrong object or was given the transform. Honestly, I would like to give you a definitive answer but there really are a million different reasons as to whats wrong. If my suggestion doesn't yield better results try finding a download for the completed Lerpz project and cross check it to the letter with your own, that will give you your answer but will of course take time.

avatar image
0

Answer by CharlesD · Aug 21, 2012 at 07:03 AM

Ah I wish someone would update that tutorial, some parts of it just seem out of date nowadays. But anyways... the error you received was not necessarily because of your script, while it did encounter an error it was not because it wasn't functioning correctly but rather it was looking for something that did not exist (See Dependencies in the blue box on page 16 of the tutorial). The ThirdPersonAnimation component depends on a component of type Animation to work and according to the error you received, there is no Animation component on the player. Now I believe that the Lerpz prefab you should have drug into your level at the start of the tutorial has an Animation component already attached to it, if not then the ThirdPersonAnimation component you added should have added one for you or there is something wrong with the assets you downloaded for the tutorial. I can't really answer in detail what's wrong without knowing a few more details however. First, did you in fact drag the Lerpz prefab from the project window into your scene? Second, did you download the Lerpz tutorial from Unity's website or somewhere else? Finally, does your Player have an animation component attached (click your player in the Hierarchy view then look for it in the inspector)? Oh and one final side note, you are probably wondering why the error message you received was pointing to a specific line in a specific script... well whenever a script encounters a problem an error is logged with unity, the line # is simply an indication to the specific part of the code which encountered a problem, be it a problem in the script such as syntax or a problem the script encountered. In your case the error points to a specific block of code where the script encountered a problem starting at line 69 and ending somewhere else the "{" and its partner "}" indicate a block of code. Sorry if what I said seems either too complicated or too basic, I'm trying to give you all the information I can.

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 capasha · Feb 26, 2013 at 01:42 AM

I had the exactly same issue. I recreated everything and followed the tutorial again. And found in one of the images did it exists Animation in the Inspector for the Player object. Which I didn't have in my Inspector. So I just added a Animation from Add Component. But still got a lot of errors. I Clicked on the circle between walk, and clicked on all animations. And tried to run. Now didn't I get any more errors. But I still can't control the player. Which is there I'm stuck now.

^ Used wrong method.

Edit: Looks like I have been changing the Child instead of the Root Object.

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

9 People are following this question.

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

Related Questions

Lerpz Tutorials Animation Problem 0 Answers

blender animations problem (or bug) in mecanim 0 Answers

UCE0001: ';' expected. Insert a semicolon at the end 1 Answer

Animation problem 1 Answer

Rotation in animation problem 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