How can I see the actual code used in a C# library?

110 Views Asked by At

I want the actual code used in a library called:

using UnityEngine.Advertisements;

to see

But when I press Ctrl+Enter on it

Only the methods are defined and not their codes like:

        public static void Initialize(string gameId, bool testMode);

Can you see the original codes used?

1

There are 1 best solutions below

0
TheNomad On

Unity is a C++ engine that has a C# layer.

A lot of the C# library code is actually just a way that allows game makers to access that C++ code. So for short, you won't be able to view most of the actual code. I say "actual", because there is also some logic done in C# that handles the "result" (for lack of a better word) part of the engine.

Also, code regarding Unity Services will mostly be on the server anyway. Things like lobby management and monetization is server side, with the C# (and possible the C++) client just handling interaction between the game and the Unity servers.

This is also valid for .NET, Mono, Java and more. Even if you get decompilers and unpack most of the libraries, you won't, for example, see code that returns the current OS username that runs it, since it's on the native layer. This is similar to the same approach UnrealEngine 1, 2 and 3 games had where, while you had access to the UnrealScript code, part of it called native functions in C++.