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 /
This question was closed Sep 26, 2017 at 02:05 PM by nocoast for the following reason:

The question is answered.

avatar image
0
Question by nocoast · Sep 26, 2017 at 02:23 AM · scripting problemeditorcrashing

Script Crashing (Only on first run)

I have a unity project, that when I run it in the editor with script A, it crashes on the first run of that unity session.

If I disable script A in the Inspector for the first run, the project runs fine. If I re-enable the script for the second run the project works fine (in the same unity session, i.e. without opening and closing the program).

I have commented out all of the body code in script A and it still crashes, I have moved it to the front and back of the execution order and it still crashes.

The script contains a void Start() and void Update().

Any ideas as to what is causing this?

edit: The key is that it only crashes (no console output, just crash) if I have it enabled during the initial/first time I hit play in the unity editor (I just did another test and if it is disabled and I enabled it after the editor is in the play mode, it works fine).

edit (2): Now it is crashing even if the script is disabled or removed from the scene.

edit (3): I noticed the crash started happening after using a USB controller, though I can't confirm if this is what caused the crash. I sent a report to Unity, so we'll see. Will post if I figure out the cause.

edit(4): Unity got back to me, after deleting my Library folder, everything was working as expected.

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 nocoast · Sep 26, 2017 at 02:05 PM 0
Share

edit (4): Unity got back to me, deleting the Library folder did the trick. They also suggested upgrading my Unity (i'm on windows 7).

avatar image nocoast · Oct 05, 2017 at 12:44 AM 0
Share

edit (4): Unity got back to me, after deleting the Library folder everything was working as intended, closed question.

2 Replies

  • Sort: 
avatar image
0

Answer by Agent27765 · Sep 26, 2017 at 02:26 AM

Maybe you can copy the code and make a new script file and see if that works. It seems that the script page itself is bugged. Has this ever happened to you with another script in your project?

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 nocoast · Sep 26, 2017 at 03:12 AM

I just copied and pasted the code into a new file, same issue.

The key is that it only crashes (no console output, just crash) if I have it enabled during the initial/first time I hit play in the unity editor (I just did another test and if it is disabled and I enabled it after the editor is in the play mode, it works fine).

Does the unity editor load code differently the first time/at the beginning of a play session?

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

Follow this Question

Answers Answers and Comments

138 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 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 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 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 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 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 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

Changing default animation type to Humanoid via script 1 Answer

How can I overwrite .asset using AssetDatabase.CreateAsset? 2 Answers

How do I solve a BuildAssetBundles Compilation Error that only occurs in the Editor? 1 Answer

Script works in Game View, but not in build 0 Answers

Can I know why I can't control volume of audiomixergroup without exposing parameters? 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