Problem is not reproducible or outdated
I can't add the script to fix my broken script, because my script is broken
Basically I referenced something that doesn't exist yet in a C# class. I'm now trying to add the script that creates those references to the same prefab, but because I have an obvious compile error it won't let me add the script until I fix it.
"Please fix compile errors before creating new script components"
If there's no work around for this I'm going to be a little upset.
It's a reference that affects a bunch of the code, so commenting it out creates more problems. Even when I remove the component script from the game object I still have the same problem. This is such a stupid feature in Unity.
Can you just make a skeleton version of that missing component from within the same script to get your errors to go away?
Answer by eliweston · Mar 03, 2018 at 05:14 AM
It just started working. Did unity read my new script and create associations without me adding the scripts to the same object? I'm really glad it's working now, but I'm still confused as hell.
You probably created and fixed a simple script error without realising it. This has the knock on effect of you 'fixing' half your code base chasing what you think it a different error but its probably actually non-existent due to the scripts not recomiling yet. Classic cases of this are Duplicated and sometimes inappropriately named Classes which have confused the compiler and its not sure what to tell you.
Follow this Question
Related Questions
Need help with c# 1 Answer
Set the username with an inputfield ? 3 Answers
transform.localscale to specific size 1 Answer
how to make mathf.pingpong not from 0 3 Answers