Search Unity

How to avoid addressing a class by its namespace?

Discussion in 'Scripting' started by Ultermarto, Apr 4, 2014.

  1. Ultermarto

    Ultermarto

    Joined:
    May 10, 2013
    Posts:
    31
    Hello.

    EDIT: Okay I must have made a mistake, because it works now. But while I'm asking, why is it that I can't import an enum? I created an enum in an alternate namespace, and when I import it through that namespace I have to address it in an awkward way

    Code (csharp):
    1.  
    2. namespace Sandwich
    3. {
    4.    public enum filling {cheese, ham, lettuce};
    5. }
    6.  
    7. // In alternate program.
    8. using Sandwich;
    9.  
    10. {
    11.    myEnum = cheese;   // Doesn't compile.
    12.  
    13.    myEnum = filling.cheese;   // Compiles.
    14. }
    15.  
    Any way to fix this?
     
    Last edited: Apr 4, 2014
  2. Deleted User

    Deleted User

    Guest

    Code (csharp):
    1.  
    2. using MyNamespace;
    3.