C
C#

✅ Quick - Unity "using" directive

✅ Quick - Unity "using" directive

AAdiZ11/19/2023
Really quick question guys, when trying to use methods from other scripts in Unity, let's say the other script's name (and therefore the other script's class name) is Decoders, do I do using Decoders; or using static Decoders;?
AAngius11/19/2023
C# is C# using is for namespaces And lets you use all classes from that namespace using static is for static classes and lets you use methods of that class directly
AAdiZ11/19/2023
Ok perfect thank you Because Unity flashed me an error for doing using static but it disappeared when I changed it to using - and now the opposite behaviour is happening when I try to reproduce it - must be a glitch of some sorts.
OOphura11/19/2023
when using static is used against a type, it means to import all static members of said type (the type itself is excluded, unless it's been imported by another using). static members include: - nested types - fields with the static modifier - properties with the static modifier - methods with the static modifier - fields with the const modifier it's important to note that the type itself doesn't have to be static. additionally, the use of the using keyword in this syntax:
using NewNamespace = Namespace;
using NewNamespace = Namespace;
or
using NewNamespace = Namespace.NestedNamespace;
using NewNamespace = Namespace.NestedNamespace;
or
using NewType = Namespace.Type;
using NewType = Namespace.Type;
is meant to introduce an alias for a given namespace and/or type. the following however:
using Type = Namespace.Type;
using Type = Namespace.Type;
is used to import a single type rather than define an alias for it, to exclude all other types in said Namespace that might cause ambiguity or some other issues...

Looking for more? Join the community!

C
C#

✅ Quick - Unity "using" directive

Join Server
Want results from more Discord servers?
Add your server
Recommended Posts
✅ .Split() Returning Spaces Between Words in String[]Hi. I have an string array `string[] strArr` of words in format `[word1, word2]` and so on - just a I want to compile a program myself with less filesI was working on a open source project, and I want to compile the program myself so I setup a github✅ Finding Processes but it displays as invisibleSo I am making a system monitor, and I ran into a problem where when I click the button to display t✅ Getting artifact from GitHub Repo ends in SSL_ERROR_SSLHello guys, working on a console app to more or less download artifacts from our private GitHub Repo✅ DB ErrorHey guys, I am working on a project and I am trying to connect it to a DB. I am following the instruCalculate Field Offset Based On Members' NameI'd like to know if the offset calculation is correct. the input used is as follows```cs private coFollowing a video to create power ups, but its not picking them up and I dont know why.Heres the code. I dont know whats wrong with it, from what I can tell its exactly the same as the vConverting int to double to output with decimalsHello again! i got a little problem with converting int to double, i dont get it to output the decimDb ConnectionGood afternoon guys, I need some help setting up the database connection for my project. I have thCan't read property in code behind```cs @page "/weather" @attribute [StreamRendering] <PageTitle>Weather</PageTitle> <h1>Weather</h1RabbitMQ starting service issuePlease guys I had `RabbitMQ` running fine, but after restarting my computer the RabbitMQ won't be stException Unhandled : Could not load file or assembly 'Serilog.Extensions.HostingWhen I run my application, this exception is thrown even before the start of debugging. System.IO.Figot this code that i wrote the get all score and print end score but i didnt read right help meexem is 40% assigments is 30% and participation is 30%Assistance regarding deciding on what to use.Hello there, I want to port one of my macOS apps to a native windows app and would like to ask which✅ C# SMS/MMS BotI have a project I'm working on I have a working PBX that receives SMS and MMS messages to a web conHelp deciding Next.js/Node.js vs .NET API back-endHello. I really want to use .NET as my API back-end for a practice app I'm building. However, I do