Search Unity

Resolved Visual Studio does not compile

Discussion in 'Scripting' started by MinhocaNice, Jun 5, 2022.

  1. MinhocaNice

    MinhocaNice

    Joined:
    May 3, 2020
    Posts:
    249
    I passed my Unity project to my colleague who is making animations and models, and when I reimported the project, Visual Studio 2019 does not compile the code, when I open it it doesn't mind any typoes and I have to rely on Unity's own compiler to know what is wrong, which is very inconvenient.

    I also changed my computer in the mean time so this might be the reason.

    Code (CSharp):
    1.                         if (MultiMuzzle)
    2.                         {
    3.                             Projectile = Instantiate(ProjectilePrefab, MuzzleTransformArray [CurrentMuzzle].position, MuzzleTransformArray [CurrentMuzzle].rotation).GetComponent<Rigidbody>();
    4.                         }
    5.                         else
    6.                         {
    7.                             Projectile = Instantiate(ProjectilePrefab, MuzzleTransform.position, MuzzleTransform.rotation).GetComponent<Rigidbody>();
    8.                             ergfjuibegrtiyuoergbiedrtgog //Apparently Visual Studio thinks this is fine//
    9.                         }
     
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,861
    Sounds like a botched Visual Studio to Unity integration. Was Visual Studio installed via Unity?
     
    MinhocaNice likes this.
  3. MinhocaNice

    MinhocaNice

    Joined:
    May 3, 2020
    Posts:
    249
    That was exactly it, I didn't have the Visual Studio 2019 attached in the "External Tools" in Unity Preferences, sorry the trouble.