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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by Kantus · Mar 09, 2015 at 10:14 PM · c#script.bugreadcannot

An Utterly Baffling Problem

Hello all,

I'm in a situation that I've never even heard of before.

Basically, I had a problem wherein my Player object would have a certain attribute set to null when they were deleted and respawned. So I fixed it. The thing is, I have two player objects, Player 1 & Player 2. I only fixed it on Player 1, and forget to do so on Player 2. I forgot to make the Respawner spawn Player 1s instead of Player 2s, so it continued to be broken. Several days later I then horribly messed up Player 2's code with several botched attempts to fix the bug I'd already dealt with before. Then of course I noticed that it was spawning Player 2's instead of 1's, so I changed it, which solved the problem.

The really weird part, though, is that if I try to access the Scripts on the Player1 Prefab, MonoDevelop opens the equivalent script on Player 2 - which is broken, and causes Player 1 to no longer work until I reset the console. So, is there some way I could access and properly look at the code attached to Player 1, in case I need to change it in future?

Thanks Cantus

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 Pendantic · Mar 09, 2015 at 10:18 PM 0
Share

Are your two players using a completely different script? as in do you a different cs/js file for each player?

avatar image Kantus · Mar 10, 2015 at 11:59 AM 0
Share

That's what I'm not clear on. I don't think that's actually the case - I think I may have edited the same .cs files, but that the "correct" files, saved in the Player 1 prefab, are somehow being preserved. What I'd like to know is how to access those files, since opening them in $$anonymous$$onodevelop (in fact, even clicking Player 1's associated scripts in the Inspector) seems to associate Player 1 with the "broken" scripts, thus breaking it and forcing me to quit without saving. I tried exporting Player1's prefab and then importing it into a new project, but that just broke the attached scripts. So, basically, I'm stuck with something of a Black Box - it works, but I can't get inside it to look at it without breaking it, at least not with my current level of knowledge.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by SecondMouse · Mar 09, 2015 at 11:45 PM

I'm no expert but MonoDevelop gives me issues a lot. I recommend you DL and use MS Visual Studio. Or you can always open the code in something like Notepad to see the raw code.

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 Kantus · Mar 10, 2015 at 12:08 PM 0
Share

The problem there, though, is that opening a Prefab results in sheer, garbled nonsense, and trying to open the scripts attached to the Prefab associates the Prefab with the "broken" scripts, thus breaking Player1.prefab. Is there no way to somehow extract the code from the prefab? Otherwise I'll have to go back to dealing with that absolutely maddening problem, the one wherein Unity constantly -constantly- thinks that the Player is null after the player dies, despite the absurd number of safeguards I built into the code to prevent that from happening. And it's only seemed to get worse as time progresses - first you can't swap weapons because null, but you can turn around. Next, you can't turn around because null, but you can still respawn. Now, you can't even respawn, because null!...

Eh. Please forgive me. I just get incredibly frustrated when I can't see what I'm doing wrong.

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

23 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

Related Questions

Help, Reading a Json file (getting error KeyNotFounfExeption) 1 Answer

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

How can I fix this error in my Candy Crush style game? 0 Answers

EditorGUILayout.ObjectField obsolete? 3 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