Skip to content

[Feature Request] Remove unneeded prefixes from C# Preview code #79

Closed

Description

@Jax-Danger

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.

Activity

  1. S2NX7 commented on Jan 31, 2026

    @S2NX7
    Collaborator

    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.

  2. Jax-Danger commented on Jan 31, 2026

    @Jax-Danger
    Author
    Image

    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;

    Image

    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.

  3. S2NX7 commented on Jan 31, 2026

    @S2NX7
    Collaborator

    Oh ok I did fix some of the cases where this happens(Not all) I pushed the change so you can just press update

  4. added
    Working onThis issue is currently being worked on
    and removed
    Working onThis issue is currently being worked on
    on Feb 2, 2026
  5. Repository owner deleted a comment from github-actions on Feb 3, 2026
  6. Repository owner deleted a comment from github-actions on Feb 3, 2026
  7. added
    Working onThis issue is currently being worked on
    and removed
    Working onThis issue is currently being worked on
    on Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working onThis issue is currently being worked onenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions