Editing Modding Tutorials/Writing custom code
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 68: | Line 68: | ||
</source><br/> | </source><br/> | ||
− | You can set your project's namespace by | + | You can set your project's namespace by right-clicking MyProjectName -> Properties -> Application -> Root namespace. Please take some time to make it unique so no compatibility issues will arise with other mods, for your and everyone else's sanity.<br/><br/> |
====Summary==== | ====Summary==== | ||
Line 159: | Line 159: | ||
## Make sure your project's output type is "class library"; | ## Make sure your project's output type is "class library"; | ||
## '' '''Note:''' by default, Visual Studio will compile all the references of the project as well, so you’ll get a copy of UnityEngine.dll and Assembly-CSharp.dll and some others. Just take ''MyModName.dll'' and place it in the ''MyModName/Assemblies'' folder. If you have [[Modding Tutorials/Setting up a solution|set up a solution]] according to the tutorial you don't have this problem, | ## '' '''Note:''' by default, Visual Studio will compile all the references of the project as well, so you’ll get a copy of UnityEngine.dll and Assembly-CSharp.dll and some others. Just take ''MyModName.dll'' and place it in the ''MyModName/Assemblies'' folder. If you have [[Modding Tutorials/Setting up a solution|set up a solution]] according to the tutorial you don't have this problem, | ||
− | # Reference the classes in your .dll | + | # Reference the classes in your .dll from the xml data in the MyModName/Defs folder; |
− | |||
## '''Example:''' Write a [[Modding_Tutorials/Hello_World|Hello World]] mod | ## '''Example:''' Write a [[Modding_Tutorials/Hello_World|Hello World]] mod | ||
## '''Example:''' Create a new ThingDef with a <thingClass> that points to a class in your .dll (see, for example, [[Modding_Tutorials/Def classes|Def classes]] and [[Modding_Tutorials/Modifying defs|Modifying defs]]) | ## '''Example:''' Create a new ThingDef with a <thingClass> that points to a class in your .dll (see, for example, [[Modding_Tutorials/Def classes|Def classes]] and [[Modding_Tutorials/Modifying defs|Modifying defs]]) | ||
# The game should load your class now;<br/><br/> | # The game should load your class now;<br/><br/> | ||
− | = | + | =See also= |
− | |||
− | |||
− | |||
− | |||
* [[Modding_Tutorials/Distribution|Distribution]] details how to release your mod. | * [[Modding_Tutorials/Distribution|Distribution]] details how to release your mod. | ||
+ | * [[Modding Tutorials/Assembly Modding Example|Assembly modding example]] contains a small modding example.<br/> | ||
[[Category:Modding tutorials]] | [[Category:Modding tutorials]] |