i love visual studio’s “attach to unity and play” (when it works, sometimes it a bit flaky but mostly good)
the only thing is, if i have compile errors, it starts unity anyhow. this is very confusing if you don’t notice, and i’d like it so give me an error message and not start unity, so i can fix the error.
is there a setting for that?
thanks
1 Answer
1
If I understand your question right. I would recommend only attatching to unity when you are going to set a breakpoint to check values excetera. If so i have found its easier to: set your break point(s) , then, “Attach to unity” (not attatch and play)… manually play from the unity editor.
Quick note - When debugging in this way it can take alot of resources and is not always necessary. It can slow your development down. For simple debugging, try using unity’s “error pause” feature. And review the code line the console displays. Hope this helps.
When you declare a MonoBehaviour, it has a type public class PlayerHealth : MonoBehaviour // PlayerHealth is the type here { public int health = 100; } So you can do GetComponent<PlayerHealth>().health -= 1;
– UnityCoach