- Home /
Yellow problem on VSCode,working code but worried.Referencing another script variable.
Im just trying to reference another variable from another script to change the variable but i always get this problems that says(full one at bottom).
"The type ScriptTwo in (folder directory) conflicts with the type ScriptTwo in UnityEngine.UI,Version=1.0.0.0....."
It doesnt break the code or anything but just gives me 3 different yellow problems in VSCode. So instead of trying to figure out this in my project i just made a new one to do a basic reference from one script to another.And i reproduced the problem when the code still works.So here it goes.
public class ScriptOne : MonoBehaviour
{
void Start()
{
ScriptTwo.variable = true;
}
}
The other script.
public class ScriptTwo : MonoBehaviour
{
public static bool variable;
}
Also tried medium way with
public class ScriptOne : MonoBehaviour
{
public ScriptTwo secondScript;
void Start()
{
secondScript.variable = true;
}
}
The other script.
public class ScriptTwo : MonoBehaviour
{
public bool variable;
}
Showing that it works
The type 'ScriptTwo' in 'd:\PROJECTS\checkref\Checkreference\Assets\Scipts\ScriptTwo.cs' conflicts with the imported type 'ScriptTwo' in 'UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'd:\PROJECTS\checkref\Checkreference\Assets\Scipts\ScriptTwo.cs'. [Unity.TextMeshPro, Unity.Timeline, Unity.TextMeshPro, Unity.Timeline, Unity.TextMeshPro, Unity.Timeline, Unity.TextMeshPro, Unity.Timeline, Unity.TextMeshPro, Unity.Timeline, Unity.TextMeshPro, Unity.Timeline, Unity.TextMeshPro, Unity.Timeline, Unity.TextMeshPro, Unity.Timeline, Unity.TextMeshPro, Unity.Timeline, Unity.TextMeshPro, Unity.Timeline, Unity.TextMeshPro, Unity.Timeline]
Answer by HappyPixel27 · Jul 02, 2020 at 02:13 AM
I did the exact same thing and i didnt get any problem. Check and see if your unity version is up to date and that your computer is up to date.
Your answer
![](https://koobas.hobune.stream/wayback/20220613002236im_/https://answers.unity.com/themes/thub/images/avi.jpg)