Search Unity

VRWorks from Asset Store 'using' error, CS0138

Discussion in 'AR/VR (XR) Discussion' started by ivanmotta, Jul 12, 2017.

  1. ivanmotta

    ivanmotta

    Joined:
    Jun 19, 2013
    Posts:
    23
    Hey guys
    I've downloaded the NVIDIA VRWorks package from the asset store, with hopes to boost my Vive game. Followed the steps from the Doc and the site (the same thing actually), but keep getting the "error CS0138: A 'using' directive can only be applied to namespaces but 'NVIDIA.VRWorks' denotes a type. Consider using a 'using static' instead."
    I did get rid of the error by inserting my code below inside VRWorks.cs own Start method, but course it's not optimal to keep editing it (and keep getting nasty errors, like geometry only rendering on 1/4th of screen, but terrain on all of it). What am I getting wrong?
    Code (CSharp):
    1. using NVIDIA.VRWorks;
    2. //blablabla
    3. void Start(){
    4. if (IsFeatureAvailable(Feature.LensMatchedShading))
    5.           SetActiveFeature(Feature.LensMatchedShading);
    Just in time, I'm on a Core i7 16gb RAM w/ a GTX 1070 and HTC Vive, using 2017.2.0b2
    Thanks!
     
    Last edited: Jul 12, 2017
  2. srmojuze

    srmojuze

    Joined:
    Mar 18, 2013
    Posts:
    127
    Hi, try in a script attached to the camera where the VRWorks scripts are, no need to use "using NVIDIA.VRWorks" etc.

    Code (CSharp):
    1. void Start()
    2. {
    3.     var theVRWorks = GetComponent<NVIDIA.VRWorks>();
    4.     if (theVRWorks.IsFeatureAvailable(NVIDIA.VRWorks.Feature.SinglePassStereo))
    5.     {
    6.         theVRWorks.SetActiveFeature (NVIDIA.VRWorks.Feature.SinglePassStereo);
    7.     }
    8. }
     
    matEhickey likes this.