- Home /
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
Are your two players using a completely different script? as in do you a different cs/js file for each player?
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.
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.
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
Follow this Question
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