Search Unity

Consequences of namespace import

Discussion in 'Scripting' started by jakejolli, Oct 7, 2015.

  1. jakejolli

    jakejolli

    Joined:
    Mar 22, 2014
    Posts:
    54
    I'm thinking about optimization, and I began wondering if there is a cost to importing namespaces.

    For example, if I have a namespace called 'Enemy' and a class inside that namespace, say 'Goomba', are there any benefits/consequences to using one of the following over the other as far as performance or file size is concerned?

    Code (CSharp):
    1. using Enemy;
    2.  
    3. Goomba goomba;
    4.  
    5. Start(){
    6.    goomba = new Goomba();
    7. }
    Code (CSharp):
    1. Goomba goomba;
    2.  
    3. Start(){
    4.    goomba = new Enemy.Goomba()
    5. }
     
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    Nope. After it's compiled, these are identical. "using" only matters for code readability.
     
  3. jakejolli

    jakejolli

    Joined:
    Mar 22, 2014
    Posts:
    54
    Right on. Good to know. Thanks