~[The Basics of Modding]~ Before we start making the mod, make sure that you've downloaded all the files from the sticky thread [Required Mod Assemblies]. Start Visual Studio & Start a new project. (File>New>Project) Make it a Visual C# Class Library file & name it to Mod_<Insert Name> (ex: Mod_DisplayText) Then remove all the generated code from the class. Spoiler: step 1 In order to implement any code into the game, we'll need a reference to the game engine's assembly. These files can be found at ".../Zerahypt/Zerahypt_Data/Managed" Since we're making a simple mod, we'll only have to add the UnityEngine & Mod Foundation DLL. Right Click on References in the Solution Explorer>Add Reference Spoiler: step 2 Remove all the code in ur class & replace it with the following: PHP: using System.Collections;using UnityEngine;public class <InsertClassName> : MonoBehaviour{} Spoiler: step 3 Now we want to specify to the modloader that we want to run this script. We do this by adding the [Mod_Instance] attribute from Mod_Foundation. Spoiler: step 4 Now let's set the correct build settings. Go to Project>Properties > Make sure you know where the build location is set. > Set the target framework to .NET Framework 2.0 (Unity uses this version) > Save all the scripts > Press F6 to compile the scripts to ensure that there are no errors. Spoiler: step 5 Now lets add code to display text! This goes in between the brackets of the class. PHP: void OnGUI() { GUI.color = Color.red; string text = "Mod Loaded! :D"; GUI.Label(new Rect(0, 0, Screen.width, Screen.height), text); } Spoiler: step 6 Now rebuild/recompile the code & go to the output folder. There should be a DLL file with the name of ur Mod. Move this file into the Zerahypt/Zerahypt_Data/Mods/ folder. Now run Zerahypt & let the magic happen! Spoiler: step 7
Very well-structured and helpful! The only modding I've done before is of N64 games, but I can see myself giving this a shot sometime.
@Magiichan Thanks for the tutorial, its very well done. I can't wait to dive in and see what is possible.
I did not know this and will delete le post Still nice and clean tutorial, didn't get any feet stuck in fridges during the process All me being stupid aside, Is there a way to keep things going while switching levels/maps? Every time you load into a new map or do the shift + 0 thing (or die by jumping off) The text, and whatever one might put in the mod, Isgone
Just did a successful build of the above (although I had to use Unity's version of MonoDevelop, as VS didn't have all the correct project options). Now that I have it working, it's time to do some fun stuffs! Also, is it possible to load in custom models? And if so, how? This is my first time modding a game that uses the Unity engine.
Yeah, but it's very annoying. The documentation states that u need to use asset bundles. But since they are quite outdated, you'd probably be better off using a custom library for it. I'll see if I can make a tutorial for it =P Great to see that people are also doing stuff :3
That would be great if you could. Also, is there any way for me to use UnityScript (which I'm far more familiar with)? If not, I can just use C# - not too hard to get used to.
It's ok - I realize that (especially from a modding perspective) UnityScript is more limited than C# anyway. I'll just have to get used to the new syntax/requirements. :P
Yeah, I mean I've done a little, so it's not a stretch. ;) Also, I am currently working on a console that will be useful for others to create mods in the future. Some of the things it will display: World coordinates List of currently-loaded objects Level names List of components attached to a specific object Unity version (Syrsa needs to update! We'll get things like shadows if he does!) These will be accessible via a command in the console. Any other suggestions for useful commands?