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 /
  • Help Room /
avatar image
3
Question by xXCastigamattiXx · Jul 16, 2018 at 10:59 AM · editorbug-perhaps

Can't add scripts - "Can't add script behaviour TMP_CoroutineTween [...]".

I get this error message in a pop up while trying to add a script to a empty GameObject:


can't add script behaviour TMP_CoroutineTween


Have no idea of why. It appears insistently each time I try to drag and drop the script to the game object. Finally I closed and reopen Unity3D Editor, deleted the game object end created a new one and I was able to ad the script, so now the problem for me was solved.


But I wanted to report this because I think this could be useful to somelse that could have the same problem.


It could be a bug of the Editor, I suppose.

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

5 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by dctoday · Aug 16, 2018 at 09:33 AM

Answer Edit: The issue is caused when changing the script file name after creating it. The class name within the script at the top of the file must also match the file name.

Quote from documentation: The name of the class is taken from the name you supplied when the file was created. The class name and file name must be the same to enable the script component to be attached to a GameObject.

Hope this helps someone as it fixed it for me. =)

Cheerio, Cormac


Hi,

I too am having this issue in latest Unity 2018.2.3f1 where I right click in project folder and create new C# Script. I change name to CharacterBehaviourScript and it contains the default text.

Now if I try drag this onto my player object, I get the same error. I've found no way around this, so I don't think it's my script as I was following a YouTube tutorial with the exact same code.

Please advise?

Comment
Add comment · Show 4 · 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 dctoday · Aug 16, 2018 at 09:35 AM 0
Share

Just to add this link which may be of help: https://docs.unity3d.com/$$anonymous$$anual/CreatingAndUsingScripts.html

avatar image kylander · Aug 28, 2018 at 08:57 PM 0
Share

dctoday's solution worked for me. Rena$$anonymous$$g the script and gameobjects to the same name fixed it. Thank you!

avatar image the-riot · Sep 15, 2018 at 08:11 PM 0
Share

Seems like unity dropped the ball on this error message. Its completely uninformative. Terrible.

avatar image fmigliorelli · Feb 01, 2019 at 12:18 AM 0
Share

dctoday's solution did work- kylander- are you doing the pixelnest tutorial by chance?

avatar image
0

Answer by Bunny83 · Jul 16, 2018 at 11:34 AM

If that "TMP_CoroutineTween" script file is from TextMesh Pro, then you're not supposed to add it to a gameobject. Only MonoBehaviours can be added as component to a gameobject. Not every script file contains a MonoBehaviour derived class. It seems you're using third party code here and just don't understand how to use it. So i recommend to read the documentaion of that third party product.


This is certainly no bug in Unity. As far as i can tell from a version i've found on the net, the "TMP_CoroutineTween.cs" file contains only internal classes and structs of the TextMeshPro framework.

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 Rollie42 · Jul 24, 2018 at 06:51 AM 1
Share

@Bunny83, I got the same issue - added a completely unrelated script with a single, simple class extending from $$anonymous$$onoBehavior, and the error complains about T$$anonymous$$P_CoroutineTween. Restart unity, and doing the same action now complains "Can't add script behavior UICanvas...". It is behaving as if when you drag+drop from assets folder, the message sent was "add script at index 23", and then the editor looks up index 23 in a separate script array. Tried deleting and re-adding, restarting client, etc, all without success. And in case you still think this is just a class problem, here it is:

 // A class to expose Unity events to non-Unity handlers
 using UnityEngine;
 
 
 public class EventGlue : $$anonymous$$onoBehaviour
 {
     EconEvent<EventArgs> UpdateEvent { get; set; } = new EconEvent<EventArgs>();
     EconEvent<EventArgs> FixedUpdateEvent { get; set; } = new EconEvent<EventArgs>();
 
     void Update()
     {
         UpdateEvent.Invoke(new EventArgs());
     }
 
     void FixedUpdate()
     {
         FixedUpdateEvent.Invoke(new EventArgs());
     }
 }

But the implementation doesn't seem to matter - none of the scripts that I have (and have used elsewhere in the project) seem to work suddenly (I've been doing some refactoring, so that's likely the impetus of this problem). I'm sure there's a workaround, but it's by no means as simple as you seem to suggest.

avatar image
0

Answer by voidhope · Aug 27, 2018 at 03:34 PM

I met the same problem when I tried to attach PlayerController.cs to a game project. The VS debug errors analysis indicates PlayerController this name is kinda an exiting class or function. After I changed the cs name it became fine.maybe you can try this way.

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 teamasterln · Oct 03, 2018 at 12:37 PM

I had same problem. Deleting TextMeshPRo completly from project and than adding it again helped me

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 goodcompany54 · Jan 10, 2019 at 03:50 PM

Same Problem too often 1.Created & Named new script using Visual Studio 2017. Didn't rename it or anything else. 1. Tried to attach script to game Object/ Any Object. 2. Got then and gets now "Can't add script behaviour tmp CoroutineTween. The script needs to derive from monoBehavior" 3. I usually get around this problem by creating a new script and a new name, but not this time.

Defeated but not gone!

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

185 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 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 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

Image Component is always null even when I assign it myself in the editor 1 Answer

Debug.Log not working 1 Answer

Can't enter Play mode with DOTS package enabled. 0 Answers

Strange Memory Leak in Unity Editor 0 Answers

Anyone else having issues in 4K? 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