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 ticofa · May 24, 2015 at 10:55 PM · scripting problemprofilerupdate functionremovedeleted

Script still runs even after i erase/remove it :(((

As the titles says... Even if i erase the script, it still keeps running the Update/LateUpdate and Start functions :S I checked with the Profiler and it steals a lot of Time ms and frames :((...

How do i stop them from working? I have it on a lot of objects and after sometime all those objects have the script removed, but they (all the scripts) still run, making the game reeeeallly slow :C

Thanks in advance ^_^!

Comment
Add comment · Show 2
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 ticofa · May 24, 2015 at 11:24 PM 0
Share

BTW... It appears that only the scripts that are attached to Instantiated objects seem to run after removed :S

avatar image Bunny83 · May 24, 2015 at 11:30 PM 0
Share

How do you "remove" them? Do you use Destroy()? You need to give more information. Show us the code which you use to destroy the script. Show some screenshots which show the gameobject in question.

3 Replies

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

Answer by ticofa · May 25, 2015 at 12:01 AM

Ok i just found out what the problem was... The problem was MY STUPIDITY XD!!!!

I had another script attaching the "script in question" on the gameobjects....

As much as i tried to erase the script from the obectjs, there was another one that was adding it again xD So to be more clear:

I was making an endless loop where the script was being removed and added, faster than the eye could see ^^! There for, I saw no script because it was being removed and added super fast, and because of that, it kept showing on the profiler and slowing the game ^^!

Thank you guys for the trouble, help AND time :'D!!!

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
1

Answer by RabidCabbage · May 24, 2015 at 11:14 PM

Are you sure you removed all references?

You could add a debug msg to the Start() method of the "removed" script that reports the host object's name & position when it loads in the scene.

 Debug.Log(gameObject.name + " at " + transform.position);
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 ticofa · May 24, 2015 at 11:23 PM 0
Share

Oh yeah I actually did that, but when I checked the object to see if it had the script, it didnt, but the script was still running... in fact, all the scripts were AND are running even after I removed them :S

PS: Thank you for the SUPER-$$anonymous$$EGA-HYPER-FAST Answer x'D :D!

avatar image
1

Answer by Bunny83 · May 24, 2015 at 11:25 PM

That makes no sense. If all instances are destroyed, nothing will be executed. If you still see them in the profiler, there's still an instances somewhere. Keep in mind that you can use the search / filter field in the hierarchy view to find instances of a script.

Start is only called when you create a new instance of the script. Maybe you instantiate a prefab somewhere which has that script attached.

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 ticofa · May 24, 2015 at 11:47 PM 0
Share

I know it makes no sense xD, but i double checked it throught Debug.Log, the Name and Position of the object to check if it had any script...

It didn't, but the script is still being called :S

See it here:

alt text

example.png (133.7 kB)

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

21 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

Related Questions

How to increment score by one, every time player moves the device face down ? 2 Answers

Update within an if statement not working? 3 Answers

fps goes down when moving the camera 1 Answer

Unity Profiler 0 Answers

Why is FindObjectOfType() called during Camera.Render? It's not in my code. 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