Search Unity

Question 'Error CS0246 The type or namespace name 'MonoOrStereoscopicEye' couldn't be found' in managed DLL?

Discussion in 'Scripting' started by AerionXI, Dec 10, 2022.

  1. AerionXI

    AerionXI

    Joined:
    Jul 20, 2020
    Posts:
    482
    How do I use `MonoOrStereoscopicEye` in my managed C# VS 2019 DotNet Network 4.8 DLL?
     
  2. Spy-Master

    Spy-Master

    Joined:
    Aug 4, 2022
    Posts:
    639
  3. AerionXI

    AerionXI

    Joined:
    Jul 20, 2020
    Posts:
    482
    Then why is it not found? I have all the dependencies already added
     
    Last edited: Dec 10, 2022
  4. Spy-Master

    Spy-Master

    Joined:
    Aug 4, 2022
    Posts:
    639
  5. AerionXI

    AerionXI

    Joined:
    Jul 20, 2020
    Posts:
    482
    I understand how to call a nested method... Camera.MonoOrStereoscopicEye, why is it saying that Camera.MonoOrStereoscopicEye is not found even with dependencies?
     
  6. Spy-Master

    Spy-Master

    Joined:
    Aug 4, 2022
    Posts:
    639
    What does this have to do with nested methods? What even counts as a nested method? All methods belong to classes.
    The specific error message in your title would only show up if you incorrectly just wrote the nested enum’s name instead of prefixing it with the containing type.
    If you’re no longer making that mistake, what is the specific error message you get, and in what context in the code? (Show an example file for people to see what you’re trying.)
     
  7. AerionXI

    AerionXI

    Joined:
    Jul 20, 2020
    Posts:
    482
    Spy-Master

    A1.png

    Code (CSharp):
    1. private static Vector3 Screen2WorldPoint ( Camera cam, Vector3 position, MonoOrStereoscopicEye eye ) {
    2. }
    3.  
     
  8. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,933
    The enum is nested inside the Camera class. So you need to use the full path. Ergo,
    Camera.MonoOrStereoscopicEye
    .

    You really need to learn some basic C#.
     
    Chubzdoomer and Spy-Master like this.
  9. Spy-Master

    Spy-Master

    Joined:
    Aug 4, 2022
    Posts:
    639
    I sent you a link that shows how you use nested types. I said explicitly what you need to do to use nested enums. What more could you possibly need?
     
  10. AerionXI

    AerionXI

    Joined:
    Jul 20, 2020
    Posts:
    482
    What @spiney199 said is enough. I got it thanks to him.

    Code (CSharp):
    1. private static Vector3 Screen2WorldPoint ( Camera cam, Vector3 position, Camera.MonoOrStereoscopicEye eye )
    2. }
    It's not what you say, it's how you say it.
    Thank you both.