Assigning an alias

In C++ you can assign an alias by typing something like

using FString = std::string;
using int32 = int;

how can I do this for C#
My Code

   void LaunchGame()
    {
        using  Rnd  =  UnityEngine.Random();
        switch (level)
        {
            case 1:
                password = passwordsIAP[Rnd.Range(0, passwordsIAP.Length)];
                if (password != lastPassword[0])    { StartCoroutine(LoadIAP()); }
                else { password = passwordsIAP[Rnd.Range(0, passwordsIAP.Length)]; }
                break;

gives me this



image

I’ve also tried it this way

@Nina,
Did you read the question?

before sending this post to the wrong section of the forum?

Sorry for the mistake. I moved your thread back. I just read the title and saw C++. Most students accidentally post their threads in the wrong subforum, and I’m giving support for the Unity courses only.

To answer your question, it works the same way in C# at the top of your script, not inside a method.

https://www.dotnetperls.com/using-alias

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms