Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7419781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:07:48+00:00 2026-05-29T08:07:48+00:00

UDK uses .NET. So maybe it is possible somehow to use .NET from UnrealScript?

  • 0

UDK uses .NET. So maybe it is possible somehow to use .NET from UnrealScript?
It is really great to use C# with UnrealScript.

One certainly could build C++ layer to interact between .NET and UnrealScript which will use dllimport, but it is not the subject for this question.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T08:07:49+00:00Added an answer on May 29, 2026 at 8:07 am

    So there seems to be no way to access .NET libraries directly from UnrealScript, but one can combine [DllExport] extension for C# and UnrealScript interop system to interact with .NET without intermediate C++ wrapper.

    Lets look at simple example of exchanging with int, string, structure and filling UnrealScript String in C#.

    1 Create C# class

    using System;
    using System.Runtime.InteropServices;
    using RGiesecke.DllExport;
    namespace UDKManagedTestDLL
    {
    
        struct TestStruct
        {
            public int Value;
        }
    
        public static class UnmanagedExports
        {
            // Get string from C#
            // returned strings are copied by UnrealScript interop system so one
            // shouldn't worry about allocation\deallocation problem
            [DllExport("GetString", CallingConvention = CallingConvention.StdCall]
            [return: MarshalAs(UnmanagedType.LPWStr)]
            static string GetString()
            {
                return "Hello UnrealScript from C#!";
            }
    
            //This function takes int, squares it and return a structure
            [DllExport("GetStructure", CallingConvention = CallingConvention.StdCall]
            static TestStructure GetStructure(int x)
            {
                 return new TestStructure{Value=x*x};
            }
    
            //This function fills UnrealScript string
            //(!) warning (!) the string should be initialized (memory allocated) in UnrealScript
            // see example of usage below            
            [DllExport("FillString", CallingConvention = CallingConvention.StdCall]
            static void FillString([MarshalAs(UnmanagedType.LPWStr)] StringBuilder str)
            {
                str.Clear();    //set position to the beginning of the string
                str.Append("ha ha ha");
            }
        }
    }
    

    2 Compile the C# code, say, as UDKManagedTest.dll and place to [\Binaries\Win32\UserCode] (or Win64)

    3 On UnrealScript side one should place declarations of the functions:

    class TestManagedDLL extends Object
        DLLBind(UDKManagedTest);
    
    struct TestStruct
    {
       int Value;
    }
    
    dllimport final function string GetString();
    dllimport final function TestStruct GetStructure();
    dllimport final function FillString(out string str);
    
    
    DefaultProperties
    {
    }
    

    Then one can use the functions.


    The only trick is filling UDK string like it is shown in FillString method. Since we pass string as fixed length buffer, this string MUST be initialized. The length of initialized string MUST be more or equal to length C# will work with.


    Further reading could be found here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm porting a game from UT3 to UDK. One of the classes is a
I'm porting a UT3 game to UDK . It uses a large code library
I get the following error in the UDK Frontend when I try to make
Upon compiling, I am getting the following error: C:\UDK\UDK-2010-03\Development\Src\FixIt\Classes\ZInteraction.uc(41) : Error, Unrecognized member 'OpenMenu'
I'm porting UT3 code to UDK, and I am getting the following compile error
I've been trying for a couple of days now to learn UDK, but I
I am translating some UDK Games so there are already some directories like German,
I am trying to create a mod in udk by adding jetpacks, so I
I am trying to create something like the UDK or Maya material editor http://www.google.com/search?q=udk+material+editor&oe=utf-8&rls=org.mozilla:en-US:official&client=firefox-a&um=1&ie=UTF-8&hl=en&tbm=isch&source=og&sa=N&tab=wi&biw=1144&bih=929
I am using a school computer and asked the administrators to install UDK on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.