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
1
Question by schwertfisch · Jan 16, 2011 at 11:28 AM · prefabinspectordeactivatecheckbox

Unchecking a prefab's script in the Inspector doesn't "deactivate" it?

I have a prefab and a script (let's call it ScriptA) attached to it.

I have made some modifications on ScriptA and renamed the new, modified version to ScriptB.

I dragged and dropped ScriptB at the end of the prefab's component's stack in the Inspector, just under ScriptA. I want to deactivate ScriptA, so I unchecked the box next to it and left only ScriptB checked.

Things don't work as expected though. It seems as the engine does what ScriptA says (although unchecked) and only when I delete it do the new modified lines of code inside ScriptB seem to be applied.

Am I missing something here? I thought what the checkboxes where supposed to do was exactly that: activate/ deactivate some components.

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 azzogat · Jan 16, 2011 at 11:32 AM 0
Share

It should work unless you're somehow activating or maybe requiring it through code. We ran into this early on when we forgot to delete a script.enabled = true; line from an awake function. The second headache inducing problem was that our game hierarchy was so chaotic that we realized we've modified some different lines in scriptB and as such it was perfor$$anonymous$$g similarly.

avatar image azzogat · Jan 16, 2011 at 11:36 AM 0
Share

(sorry for double posting) Also, calls to that particular script will still work. For example scriptA.playXSound() called from another script will still function.

avatar image schwertfisch · Jan 16, 2011 at 11:41 AM 0
Share

hmmm, I don't seem to have any of the issues you mentioned. What's strange is that when I hit play, the ScriptA's checkbox doesn't get checked (as a result of something activating it at runtime). Shouldn't it get checked automatically (I mean when I hit play)? Does this mean that something else is the matter and not that ScriptA gets activated?

avatar image schwertfisch · Jan 16, 2011 at 11:43 AM 0
Share

Just saw your 2nd comment. I have other scripts calling functions in it. Thanks. Could you put that in an answer to close this? Thanks very much azzogat!

avatar image azzogat · Jan 16, 2011 at 11:44 AM 0
Share

Yup, you are correct. If it's not activating by itself and you are not calling one of it's functions from another script (second comment) then unfortunately I have absolutely no idea.

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by azzogat · Jan 16, 2011 at 11:45 AM

Even if you uncheck a script, calling one of it's functions from another script will still work.

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

No one has followed this question yet.

Related Questions

What is the name of/How do I use the box in the Script Inspector that allows you to assign values to Public data? 2 Answers

How To Disable A Prefab? 2 Answers

How to attach a script to a static Tree Prefab? 1 Answer

Network instantiate command do not execute in all client.. 1 Answer

How can I get this script to work? 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