So, back in high school - which was like 3 months ago - some dude told me Unity does not like the following code.
using System;
Is that true? Are there any size problems at all?
Although it’s not very important and I’m so scared, I found a workaround, I’m just curious.
its not true
its only true if you use one of the classes that is present in UnityEngine and System like Object or Random
using System;
That does nothing, aside from making it shorter to type stuff. So instead of
System.DateTime.Now
You can just type
DateTime.Now
Note that this can lead to namespace conflicts, like with Random. If you import the System namespace, then call Random, Unity doesn’t know if it’s supposed to be System.Random or UnityEngine.Random. So you have to explicitly specify in that case.
All “using” (or “import” in JS) does is import a namespace. It doesn’t actually do anything at all or have any effect whatsoever on the actual compiled code.
–Eric
Would using System cause any cross platform issues like if you were to build it to Android or a web client?
no
it will just on most platforms mean a larger player cause its not added by default
Thanks. I always wondered if the System namespace was only compatible on windows platforms. Sorry for the thread hijacking, just thought it was relevant 