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 Sinncere · May 29, 2010 at 01:32 AM · crashserverclient

Why Unity Crashes on a compiled Script? (Server - Client)

Hello the question im asking is, "what are the common reasons why unity crashes? where do i stat to look for a sollution?" as i have a script that complies fine without errors, also as Server ingame works fine, but once a Client connects unity crashes, Ive snipt at the source code of the script (usin java) and narrowed it down to calling in the UPDATE():

var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
enemyTrans = MarioController.enemySelected.transform;

Once i remove these two from the source the clients connect fine and the game continues. But i would like to know the asnwers to my question abouve, as its essential that i use raycast in this script as all my other functions depend on it.

regards

Antione

Comment
Add comment · Show 1
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 spinaljack · May 29, 2010 at 01:36 AM 0
Share

how is the client set up? could it be that it's creating more cameras or mouse inputs or screens?

3 Replies

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

Answer by jashan · May 29, 2010 at 12:12 PM

Regarding your "main question" ("what are the common reasons why Unity crashes? Where do I start to look for a solution"), the answer would be: Infinite recursions and loops and the like. In my experience, that's the single most frequent reason why Unity crashes.

I've also had issues probably related to my gfx-card a while back (when doing super-hi-res screenshots ... that not only crashed Unity but actually put my whole Mac to a halt when it happened). With such issues, it's great if you have multiple machines to test on (ideally even on different platforms).

Regarding your specific question: You already seem to have narrowed it down, which is what you'd usually try to do: First try to find a way to reliably reproduce the crash, then simplify the issue until the crash disappears, then try to make the crash re-appear. If it's a problem in your code (e.g. an infinite loop or recursion), that'll help you fix your bug - if it's a problem with Unity, it's a good foundation for writing a bug report that actually helps the UT QA and dev teams to fix the issue.

From the code you've posted, it doesn't seem likely to me that this really is the issue. It looks more like commenting these lines out would have a side-effect somewhere else that prevents the crash from happening (e.g. ray or enemyTrans not being available later and then some code causing the crash not being executed because of a null-check).

What kind of surprises me is that you don't get a compilation error when commenting out "var ray = ..."; that should mean that "ray" is never used, so that whole line is dead code that you should probably remove anyways.

Does the crash only disappear when you remove both lines? Does any functionality break when you remove those lines? If functionality breaks, look in there for what's really causing the crash ...

Ah, one final note: In general, compilation errors are much easier to find and fix than runtime errors. Crashes are always runtime errors that usually don't really have anything to do with compilation errors. When you get a compilation error, any changes you may have applied won't be available during runtime (that might be confusing when you make changes because they likely don't have any effect; always first fix any compilation errors before even play-testing your game).

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
Best Answer

Answer by Lucas Meijer 1 · May 29, 2010 at 01:38 PM

When Unity crashes, the first place I look is the editor logfile, to see if it contains any clue. If that doesn't work, I try to isolate the problem. Remove half of my code/logic, and see if it's still there. repeat untill it's gone. when you find out a subset of code/logic that's causing the problem, zoom in on that, by keep cutting away more.

When you say Crash, do you mean that the Unity Editor program terminates, and it starts over, or do you mean that the game stops playing?

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 Sinncere · May 31, 2010 at 12:42 PM

Thanks alot for your time m8 yeh it seems there reasons are endless but I managed to find out what was causing the editor to crash,it was that the instantiated network client prefab had child gameobject that uses the same script as the server instanciated network player, some scripts need To be inactive! In my case raycast and selected enemy with the related functions needed to be pit on a seperate script so i can disable it if netwrok view is not mine in the awake() function and Wala! It's works fine and doesn't crash the editor anymore. I should have known any script that has caracter controller calls in it should be inactive for remote instantiated players in your scene. Thanks again.

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

NetworkViews on Rotating Objects Crash Clients 0 Answers

Dedicated Server crashes when client calls Network.Disconnect 0 Answers

How do I connect a client to a server? 2 Answers

Pass an array from server to clients 0 Answers

Client connects to server, but Network.peerType returns Disconnected until next click 2 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