Generate Method Quick Action Customization VS 2017 and Unity

0

Hello everyone I want to make use of the Visual Studio's quick actions features, specifically the "Generate Method." What happens is if you have an undeclared method call it'll automatically declare it for you in the appropriate location.

I use VS with Unity when I try to use this feature it adds an exception throw which requires the System namespace which I really would rather it didn't as Unity's API has it's own unique object declaration and it's a hassle to delete the exception throw.

Code Examples:

void Update ()
{
    HandleSpawning();
}

It would show a compiler error of "CS0103: The name 'HandleSpawning' does not exist in the current context." You would be able to click on the light bulb on the left of the line or right click -> Quick Actions and Refactorings or Ctrl+.

It would then make a method for you by adding the following syntax bits to your existing code

using System;

[... code skipped, other cool stuff in between that's unchanged ...]

private void HandleSpawning()
{
    throw new NotImplementedException();
}

Unfortunately Unity projects rarely make use of the entire System library because of it's conflicting Object references.

How do I change this? Delete the exception throw statement is the ideal. Perhaps just change the system add to be just that one exception. Any help is very much appreciated.

Frapsity

Posted 2019-08-06T11:17:45.083

Reputation: 1

No answers