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 MandN · Jul 09, 2014 at 09:47 AM · c#

Is there any reason why I can't use 2 c# scripts on my Player?

I am still learning my way around Unity3D using the 2D feature.

I created 2 c# scripts that I need to link to my character but apparently only one is able to get linked. I tried to remove the script component and re add it but i have the same problem. ( the checkbox next to the 2nd script never shows) alt text

Do I have to do something in order to link 2 scripts to my player? Thanks a lot!

capture.png (16.8 kB)
Comment
Add comment · Show 3
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 Nerevar · Jul 09, 2014 at 09:53 AM 0
Share

Hello,

what kind of scripts are you trying to add? do you have any messages from unity?

avatar image MandN · Jul 09, 2014 at 10:36 AM 0
Share

No messages from unity.. $$anonymous$$ove commands like RigidBody 2D

avatar image Nerevar · Jul 09, 2014 at 10:53 AM 0
Share

$$anonymous$$ay we see those scripts? (are they Player.cs and CharacterControler2D.cs ?)

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by darthtelle · Jul 09, 2014 at 10:04 AM

The checkbox next to the name of the script actually refers to whether your script is enabled or disabled. The only way to enable/disable your script is if you have an Update() function inside the class. The script is still there without a tick or being enabled, it just won't actually run any Update functions.

Comment
Add comment · Show 6 · 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 darthtelle · Jul 09, 2014 at 10:54 AM 1
Share

I believe it's actually any $$anonymous$$onoBehaviour function, my mistake, it is neither just Update, nor Start. It could be examples such as FixedUpdate, Awake, etc. Because I have many, many scripts where I don't use Start and I still have a checkbox associated with that script in the editor. However, there is $$anonymous$$onoBehaviour functions inside the class.

avatar image MandN · Jul 09, 2014 at 11:19 AM 1
Share

I do have a public void Awake() function but the checkbox fails to appear unless I add a void Update () in the source.

avatar image Nerevar · Jul 09, 2014 at 11:39 AM 0
Share

Yes you atcually need one of the initialisation functions to display the check box. Did not know that :p

avatar image fafase · Jul 09, 2014 at 11:47 AM 0
Share

It seems to be that if you want the tick to show you need to have any $$anonymous$$onoBehaviour except Awake.

This is probably due to the nature of those methods. Awake is called on loading while the others are constantely checked each frame for a call (even Start, only it is not called again after first round).

avatar image MandN · Jul 09, 2014 at 12:18 PM 0
Share

Is this something that changed from 4.5? I am using 4.5.1 and someone using 4.5 has that checkbox only with Awake function.

Show more comments
avatar image
0

Answer by Kiwasi · Jul 09, 2014 at 11:12 AM

I average about five on each GameObject. The only requirement to attach a script is that is inherits from MonoBehaviour. You can also only add one copy of each script to a GameObject.

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 MandN · Jul 16, 2014 at 07:35 PM

I managed to fix the problem. I was a simple "s" missing. God damn.. Thanks guys!

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Controlling when a script is enabled with another Script 1 Answer

Raycast line in c# 1 Answer

How do I turn this into a Lerp function 1 Answer

Can't find fix for buggy camera 0 Answers

How do I stop a script from running from other scripts or from itself 2 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