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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
-2
Question by X_rploader Boss · Dec 31, 2014 at 05:01 PM · c#parsingparsing error

i am pretty sure that this is right but.....

the problems are (5,9)CS1519 and (11,9)CS1525

code:

  using UnityEngine;
 using System.Collections;
 public class Skellyattack : MonoBehaviour {
 public GameObject player;
 public GameObject skelly;
 public float distance;
 // Use this for initialization
 void Start () {
 }
 // Update is called once per frame
 void Update () {
 player = GameObject.find ("Player");
 skelly = GameObject.Find ("skeleton");
 distance = Vector3.Distance(player.transform.position. skelly.transform.postion);
 if (distance <= 3) {
 skelly.animation.CrossFadeQueued("run", 0.3f, QueueMode.PlayNow);
 }
 else if(distance < 15 && Distance > 5.0f){
 skelly.animation.CrossFadeQueued("attack", 0.3f. QueueMode.PlayNow);
 skelly.animation.CrossFade("run");
 skelly.transform.LookAt(player.transform.position);
 skelly.transform.postion = Vector3.MoveTowards(skelly.transform.postion, player.transform.position);
 }
 else
 {
 skelly.CrossFadeQueued("run", 0.3f, QueueMode.PlayNow);
 skelly.CrossFade("idle");
 }
 }
 }

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
3

Answer by Eric5h5 · Jan 01, 2015 at 06:08 PM

Pro tip: when Unity gives you an error message, Unity is correct and you are wrong.

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 RudyTheDev · Dec 31, 2014 at 05:03 PM

You really need to be able to debug and solve syntax errors yourself if you want to learn game development properly. Otherwise, you will get stuck a lot. The errors here are very obvious (besides MoveTowards speed). You should also be posting the full error message and explaining the steps you have taken to solve it yourself. Most of these errors have been answered many, many time before, if you do a quick search beforehand. And do try to format your code properly. Anyway:

 using UnityEngine;
 using System.Collections;
 
 public class Skellyattack : MonoBehaviour
 {
     public GameObject player;
     public GameObject skelly;
     public float distance;
     public float speed;
 
     // Use this for initialization
     void Start()
     {
 
     }

     // Update is called once per frame
     void Update()
     {
         player = GameObject.Find("Player");
         skelly = GameObject.Find("skeleton");
         distance = Vector3.Distance(player.transform.position, skelly.transform.position);
         if (distance <= 3)
         {
             skelly.animation.CrossFadeQueued("run", 0.3f, QueueMode.PlayNow);
         }
         else if (distance < 15 && distance > 5.0f)
         {
             skelly.animation.CrossFadeQueued("attack", 0.3f, QueueMode.PlayNow);
             skelly.animation.CrossFade("run");
             skelly.transform.LookAt(player.transform.position);
             skelly.transform.position = Vector3.MoveTowards(skelly.transform.position, player.transform.position, speed);
         }
         else
         {
             skelly.animation.CrossFadeQueued("run", 0.3f, QueueMode.PlayNow);
             skelly.animation.CrossFade("idle");
         }
     }
 }
Comment
Add comment · Show 3 · 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 X_rploader Boss · Jan 01, 2015 at 05:04 PM 0
Share

when I run the game it says:

$$anonymous$$issingComponentException: There is no 'Animation' attached to the "skeleton" game object, but a script is trying to access it. You probably need to add a Animation to the game object "skeleton". Or your script needs to check if the component is attached before using it. UnityEngine.Animation.CrossFadeQueued (System.String animation, Single fadeLength, Queue$$anonymous$$ode queue) (at C:/BuildAgent/work/d63dfc6385190b60/artifacts/EditorGenerated/Animations.cs:613) Skellyattack.Update () (at Assets/Skellyattack.cs:36)

avatar image tanoshimi · Jan 01, 2015 at 05:36 PM 0
Share

Ok, and what do you think that error message might mean...?

avatar image X_rploader Boss · Jan 01, 2015 at 08:20 PM 0
Share

i think I added an animation for it

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Looking for Code that will Read JSON files (C# code) 2 Answers

Iterating through multidimensional arrays 2 Answers

Simple Data Parsing from Text Files 1 Answer


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