You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request] Remove unneeded prefixes from C# Preview code #79
In CSharp, if the user has using UnityEngine; at the top of the file, that means you don't need to do UnityEngine.variable.function() You can just type variable.function() assuming UnityEngine has that variable. You'll notice in C# preview that the Unity.VisualScripting is grayed out, and that's exactly why. If I were to remove Unity.VisualScripting, then the code would still work the same.
Are you able to show me the case where this is happening.
But something the C# Generation does is it prefers functionality over looks so alot of the time it will add unnecessary namespaces and such. I did try to implement this functionality that you are talking about but I also have to think about ambiguous type detection so that it will add the namespace even if it's in the using so it's something I am trying improve.
This image shows Unity.VisualScripting.Variables.Object, but what I'm saying is that you don't need to have Unity.VisualScripting part since at the top we have using Unity.VisualScripting;
To my understanding of C# since I'm a little new to it, is that if you use using Something; at the top, then the part that normally would be a prefix (Something.whatever here) is not required. So instead of using UnityEngine.VisualScripting.Variables.Object.x, just make it write Variables.Object.x would still work. You'll also notice that Unity.VisualScripting is grayed out, and that's because it doesn't need to be there since the file already uses UnityEngine.VisualScripting
This would make the preview be so much cleaner and easier to read especially for someone who's trying to understand how visual scripting works and how it is read as normal C# code.
Activity
S2NX7 commentedon Jan 31, 2026
Are you able to show me the case where this is happening.
But something the C# Generation does is it prefers functionality over looks so alot of the time it will add unnecessary namespaces and such. I did try to implement this functionality that you are talking about but I also have to think about ambiguous type detection so that it will add the namespace even if it's in the using so it's something I am trying improve.
Jax-Danger commentedon Jan 31, 2026
This image shows
Unity.VisualScripting.Variables.Object, but what I'm saying is that you don't need to haveUnity.VisualScriptingpart since at the top we haveusing Unity.VisualScripting;To my understanding of C# since I'm a little new to it, is that if you use
using Something;at the top, then the part that normally would be a prefix (Something.whateverhere) is not required. So instead of usingUnityEngine.VisualScripting.Variables.Object.x, just make it writeVariables.Object.xwould still work. You'll also notice thatUnity.VisualScriptingis grayed out, and that's because it doesn't need to be there since the file already usesUnityEngine.VisualScriptingThis would make the preview be so much cleaner and easier to read especially for someone who's trying to understand how visual scripting works and how it is read as normal C# code.
S2NX7 commentedon Jan 31, 2026
Oh ok I did fix some of the cases where this happens(Not all) I pushed the change so you can just press update