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 /
This question was closed Oct 15, 2015 at 03:40 PM by Vylax for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by Vylax · Oct 14, 2015 at 11:53 AM · errorscript errordisablebce0005

Disable a script from another script

I searched everywhere and i never find an answer : I want to disable the character motor (It's right) and the MouseLook script (it's wrong)(it's called "SmoothMouseLook") and everytime I get the error following : "BCE0005: Unknow identifier: 'SmoothMouseLook'" How can I solve this ? here's my script :

  var enterRP : boolean;
  var enterWP : boolean;
  var enter : boolean;
  var enterPassword : boolean;
  
  var Player : GameObject;
  
  function OnTriggerEnter (other : Collider) {
      if(other.gameObject.name == "Player"){  
      enter = true; 
          if(Input.GetKey(KeyCode.E)){
          enterPassword = true;
         Player.GetComponent(CharacterMotor).enabled = false;
         Player.GetComponent(SmoothMouseLook).enabled = false;
         }
    }}
    
    function OnTriggerExit (other : Collider) {
    if(other.gameObject.name == "Player"){
    enter = false;
    }
    }
    
    function OnGUI(){
    if(enter == true) {
    GUI.Label (Rect(Screen.width / 2 - 150, Screen.height / 2 - 250, 150, 30), "[E] to enter password");
    }
    
    if(enterPassword == true){
    // some other code line
    }
    }

I d'ont show all GUI code and the password codes but that are working so I just want help for disabling the character motor and the SmoothMouseLook script. Thanx.

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

3 Replies

  • Sort: 
avatar image
0
Best Answer

Answer by Vylax · Oct 15, 2015 at 03:40 PM

That's write I find the solution : private var firstPersonControllerCamera; function start () { firstPersonControllerCamera = gameObject.Find("First Person Controller").GetComponent("SmoothMouseLook"); }

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 dkjunior · Oct 14, 2015 at 04:54 PM

This should fix it:

 Player.GetComponent.<CharacterMotor>().enabled = false;
 Player.GetComponent.<SmoothMouseLook>().enabled = false;
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 Vylax · Oct 14, 2015 at 06:37 PM

Now I get a new error : BCE0018: The name 'SmoothMouseLook' does not denote a valid type ('not found'). Did you mean 'UnityEngine.SendMessageOptions'? what can I do now ?

Comment
Add comment · Show 2 · 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 dkjunior · Oct 14, 2015 at 06:41 PM 0
Share

Do you have a script/component named Smooth$$anonymous$$ouseLook? From the code above I assumed you do.

(Also, as a side note, your response should've been a comment rather than a new answer.)

avatar image Vylax · Oct 15, 2015 at 02:26 PM 0
Share

Yes I have the Smooth$$anonymous$$ouseLook script and i want to disable it but the code line you gived to me was C#

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Why doesn't enabling and disabling not work? 1 Answer

error CS1525: Unexpected symbol `' 2 Answers

How to disable any type of component? 2 Answers

How to change the order of things inside of a canvas? 1 Answer

BCE0044: expecting ''', found '\r'. 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