- Home /
How do I find a method's implementation in the Unity reference source code?
Specifically I'm looking for AssetDatabase.CreateAsset
's implementation, but it would be useful to know generally. I tried searching github and cloning the repo and grep
ing but I haven't found anything that looked like the implementation.
I may have misunderstood what the unity github repo is, but can we even find the implementation details of the Unity editor on github? If the answer is yes...
Can you offer any tips to navigating Unity's reference source code?
Answer by Bunny83 · Sep 04, 2018 at 12:07 PM
The implementation is in the native code of the Unity editor. The C# reference is not the source code of the Unity engine or the Unity editor but only the source code of the .NET / Mono wrapper dlls (UnityEngine.dll and UnityEditor.dll). Most of the method are actually just declared "extern" as their actual implementation is in the native C++ code that of course is not available.´
The reference is not necessarily the whole source code for the two assemblies. If you want to see the exact definition of a certain method i would suggest using ILSpy or another .NET reflector and directly look up the decompiled code inside the assemblies. However as i said "CreateAsset" is implemented in native code and the definition just looks like this;
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void CreateAsset(Object asset, string path);
Your answer
Follow this Question
Related Questions
Publish open source game on GitHub 1 Answer
layout settings change on every commit/pull 0 Answers
Quad does not restart position 1 Answer
How can I keep track of gameobjects getting a particular tag? 1 Answer
I'm getting a weird error? 0 Answers