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 /
avatar image
0
Question by aliothman1983 · Feb 16, 2016 at 02:44 PM · scripting problemscript.new user

Unity Scripts is disabled

alt textI'm new in using unity and i have a problem that when i add new script to an object after loading it will be disabled and when i edit it i can't access functions inside rigidbody like add torque

unityproblem.png (15.2 kB)
Comment
Add comment · Show 5
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 NoseKills · Feb 16, 2016 at 03:57 PM 0
Share

We can't help you with your code if we can't see it. What do you mean by 'can't access functions' ? Nothing happens when you call it or do you get an error so you can't run the game?

avatar image aliothman1983 NoseKills · Feb 17, 2016 at 05:52 AM 0
Share

This is a screen shot for my problem

unityproblem.png (15.2 kB)
avatar image meat5000 ♦ · Feb 16, 2016 at 04:06 PM 0
Share

In edit mode make sure your scripts and objects are enabled. Save scene, save project.

avatar image aliothman1983 · Feb 17, 2016 at 05:51 AM 0
Share

@Nose$$anonymous$$ills Thanks for helping me. when i'm trying to write code rigidbody. it should give me list of function like addtorque,addRelativeTorque but I cannot see any function in the list I have attached an image of what I think it is the problem the script is not enabled.

unityproblem.png (15.2 kB)
avatar image meat5000 ♦ aliothman1983 · Feb 17, 2016 at 04:27 PM 1
Share

Its really not clear what your problem is.

Click the triangle to open the Rigidbody box. The things you mention wont appear in editor.

Are you talking about the AutoComplete in $$anonymous$$ono/VS??

Private members wont appear in editor by default.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Bunny83 · Feb 17, 2016 at 05:25 PM

I'm with meat5000. From the question and comments it seems the problem you have is related to scripting in VisualStudio / MonoDevelop. However it's not clear what the problem actually is. Also the enabled state of a script inside the Unity editor has absolutely no influence on VisualStudio / MonoDevelop. Besides that your script component is enabled since the checkbox is checked.

A Rigidbody component actually can't be disabled at all, that's why it doesn't have a checkbox inside the editor. All components can be "collapsed" / "expanded" by clicking the small triangle at the top left. However that's just a pure visualization setting in the editor. It has no influence on the functionality of a component if it's expanded or collapsed in the inspector.

trying to write code rigidbody

If you mean that you want to access the rigidbody component in your script, you have to use GetComponent<Rigidbody>(). In the past there was the rigidbody shortcut property which however has been deprecated and is no longer available. If you need access to the Rigidbody component you should add a variable to your script and initialize it in the Awake method:

 // C#
 Rigidbody rb;
 
 void Awake()
 {
     rb = GetComponent<Rigidbody>();
 }
 
 // UnityScript
 var rb : Rigidbody;
 
 function Awake()
 {
     rb = GetComponent(Rigidbody);
 }

Now you can use rb.XXX inside this script where XXX can be any instance member of the Rigidbody component. Things like rb.AddTorque(torque);

Next time if you have a scripting problem you should add more details on your actual problem. The actual code your using would be a good hint. Maybe you placed your code at the wrong place inside your script?

If this doesn't help you, you should consider to edit your question and clarify your problem because questions here on UA should be detailed and specific as well as clear and simple

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

6 People are following this question.

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

Related Questions

I'm trying to set a script to inactive 1 Answer

Why RaycastHit.triangleIndex return -1 ? 1 Answer

How can i change a button text from "Button" to example "Button1" ? 1 Answer

MissingReferenceException Problem 0 Answers

How can i set transform.position on y ? And why i'm getting error cannot convert double to float ? 3 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