• 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 gamedesigner43 · Jun 23, 2011 at 08:08 PM · componentfilename

cant add script

because of script name doesn't match the name of the file name defined in the script but it does.

here is my code

 using UnityEngine;
 using System.Collections;
 
 public class EnemyAI:MonoBehaviour{ 
     public  Transform target;
     public int moveSpeed;
      public int rotationSpeed;
     
     private  Transform  myTransform;
     
     void Awake() {
         myTransform = transform;
     }
     
     // Use this for initialization
     void Start ()  {
         GameObject go = GameObject.FindGameObjectWithTag("Player");
         
             target = go. transform;
  
     }
         
      // Update is called once per frame
     void Update () {
         Debug.DrawLine(target.position,  myTransform.position, Color.yellow);
     //Look at target
         myTransform.rotation=Quaternion.Slerp(myTransform.rotation,  Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed * Time.deltaTime);
     //Move towards target
         myTransform.position += myTransform .forward * moveSpeed * Time.deltaTime;
     }
 }
Comment
Add comment · Show 7
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 gamedesigner43 · Jun 23, 2011 at 08:15 PM 0
Share

READ PLEASE here the missining top bit using UnityEngine; using System.Collections;

public class EnemyAI:$$anonymous$$onoBehaviour{ public Transform target; public int moveSpeed; public int rotationSpeed;

avatar image gamedesigner43 · Jun 23, 2011 at 08:15 PM 0
Share

READ PLEASE here the missining top bit using UnityEngine; using System.Collections;

public class EnemyAI:$$anonymous$$onoBehaviour{ public Transform target; public int moveSpeed; public int rotationSpeed;

avatar image gamedesigner43 · Jun 23, 2011 at 08:16 PM 0
Share

READ PLEASE here the missining top bit using UnityEngine; using System.Collections;

public class EnemyAI:$$anonymous$$onoBehaviour{ public Transform target; public int moveSpeed; public int rotationSpeed;

avatar image gamedesigner43 · Jun 23, 2011 at 08:16 PM 0
Share

READ PLEASE here the missining top bit using UnityEngine; using System.Collections;

public class EnemyAI:$$anonymous$$onoBehaviour{ public Transform target; public int moveSpeed; public int rotationSpeed;

avatar image Marnix · Jun 23, 2011 at 08:33 PM 0
Share

@gamedesigner43: Don't buzz us. Just update us with extra information about your question. We can't answer your question like this.

What is the filename of your script?

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by DaveA · Jun 23, 2011 at 08:15 PM

It's called (exactly) EnemyAI.cs right?

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Can't Add Script: Can't add component 'NetworkManager' 1 Answer

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Why GetComponentInChildren is not working ? 3 Answers

Setting enabled on my objects children doesn't work 0 Answers

Reference Not Set toInstance of Object 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges