Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

After re-importing SteamVr pluggin can`t append scripts ?

Discussion in 'Scripting' started by danijel123, Apr 18, 2020.

  1. danijel123

    danijel123

    Joined:
    Jul 1, 2019
    Posts:
    10
    After re-importing SteamVr pluggin in Unity I can`t append any of my c# scripts or SteamVr scipts to any of my objects. When I try to, I get an error "can't add script component because the script class cannot be found" on all my scripts. Even if I create a new script anywhere in my project folder I get the same error. Everything worked fine before I re-imported SteamVr pluggin, any ideas what I can`t try to resolve the issue ?

    Thank you
     
  2. csofranz

    csofranz

    Joined:
    Apr 29, 2017
    Posts:
    1,556
    This is a quite irritating behaviour of Unity's. The error is because somewhere along the line, there was an error in compilation of your old scripts, and they dont yet have an assembly and can't be added to objects. You need to find the compilation errors and remove them first. However, that may not be easy, as the scripts are not marked as changed. Use a reimport, or 'touch' to mark scripts as changed so they get recompiled, and remove all compiler errors.
     
  3. danijel123

    danijel123

    Joined:
    Jul 1, 2019
    Posts:
    10
    Yes I have allready "Reimport all" in my project folder, but the problem presists. What do you mean "touch" the mark scripts, click on them ? Is there a problem with the version of SteamVR pluggin that ive re-imported, any way to import an older version of that pluggin ?
     
  4. csofranz

    csofranz

    Joined:
    Apr 29, 2017
    Posts:
    1,556
    I believe it's not the steam vr plug in per se, but a compiler error that results in any of the other, already existing scripts in your project. At least one of them will not compile, and as a result, all other scripts downstream have not compiled. That is why you can't add them to objects any more. You need to resolve the compilation issues first, then get Unity to recompile all scritps (which can be difficult because internally they are erroneously merked as 'successfully compiled').
    I'm on Unix, and the 'touch' command simply marks a file as changed - this will cause Unity to re-compile that file.