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 going to visual studio and right-clicking MyProjectName -> Properties -> Application -> Root namespace(Visual Studio 2019 it is Default 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/>
+
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 (optionally: from the xml data in the MyModName/Defs folder);
+
# Reference the classes in your .dll from the xml data in the MyModName/Defs folder;
#* {{Main|Modding Tutorials/Linking XML and C#}}
 
 
## '''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/>
  
=Examples=
+
=See also=
* Write a [[Modding_Tutorials/Hello_World|Hello World]] mod: the simplest C# project.
 
* [[Modding Tutorials/Assembly Modding Example|Assembly modding example]] contains a small modding example.
 
* [[Plague_Gun_(1.1)|Plague Gun]] How to Make a RimWorld Mod - step by step guide by Jecrell.
 
  
=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]]

Please note that all contributions to RimWorld Wiki are considered to be released under the CC BY-SA 3.0 (see RimWorld Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)

This page is a member of 1 hidden category: