using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Learning : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
When I add | int x = 3;
then in the void start method i add Debug.
Visual studio auto Generates this line of code using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine;
public class Learning : MonoBehaviour
{
int x = 4;
// Start is called before the first frame update
void Start()
{
Debug.Log (x);
}
// Update is called once per frame
void Update()
{
}
}
and I get this error = Assets\Learning.cs(12,9): error CS0104: ‘Debug’ is an ambiguous reference between ‘UnityEngine.Debug’ and ‘System.Diagnostics.Debug’
My question here is how to I keep Visual Studio from adding | using System.Diagnostics;
into my code. When I delete that line of code I can run my scene and my Console will print out 4.
So unfortunately that is not what I am talking about.
When I type in
Debug.Log
using System.Diagnostics;
will auto fill in between
using System.Collections.Generic;
using System.Diagnostics; <This is being auto-filled in]
using UnityEngine;
So if I try to put in
int x = 4;
void Start ()
{
Debug.Log (x);
}
it will auto fill in using System.Diagnostics;
which will pull up the previous error.
While if I delete the using System.Diagnostics; or comment it out
using System.Collections.Generic;
//using System.Diagnostics; <or delete]
using UnityEngine;
int x = 4;
void Start ()
{
Debug.Log (x);
}
and run the scene it will put on my console 4
I just don’t want the using System.Diagnostics; to auto fill in every time I type in Debug.Log
Code tags?
I’m sorry but I’m new to all of this.
Basically typing Debug.Log auto fills in using System.Diagnostics;
I just want to disable the auto fill in of using System.Diagnostics;
There you go mate No worries I know its all confusing, I was talking about your post here not the code you have.
Once you format your code it will be easier for everyone to read it and you will get an answer quickly I am on a phone on a train otherwise I would read it as it is but currently its really hard to read on my mobile phone in its format with the migraine I have currently, but format it properly and I will get back to you. If you cant work out the code tag thing, I will take a look at this in its current form when I get home and get back to you later if no one else has sorted it for you already
It’s good advice, but this isn’t a question that has to do with the actual scripting (just the Visual Studio application) so it’s not really critical for this post.
I know the problem isn’t precisely what is described in the video, but I think the underlying cause is the same (that Visual Studio isn’t receiving information about Unity classes), and if so the solution should be the same. Did you try the steps shown in the video?
Ok, so I did try and it does seem to be the cause of what was going on. Thank you for helping.
Now when I type in Debug.
The using System.Diagnostics; does not show up.
I went ahead and changed it. I’m sorry about your migraine, hope you feeling better though.
Thank you for showing me how to put the (code) thing into my post so I know how to do that now too.