Modding:C Sharp Scripting: Difference between revisions

Jump to navigation Jump to search
Added info on debugging
(Added quick guide to using VIsual Studio with the decompiled code)
(Added info on debugging)
Line 46: Line 46:
# Right click on your mod project in the Solution Explorer, and select Add > Reference, and then go to "Projects" in the sidebar and select the disassembled code, before clicking "OK"
# Right click on your mod project in the Solution Explorer, and select Add > Reference, and then go to "Projects" in the sidebar and select the disassembled code, before clicking "OK"
# Congrats, Visual Studio should now correctly parse your mod scripts against the existing game scripts.   
# Congrats, Visual Studio should now correctly parse your mod scripts against the existing game scripts.   
== Debugging ==
Logging can be done either by outputting text to the in-game player console like this:<syntaxhighlight lang="c#">
XRL.Messages.MessageQueue.AddPlayerMessage("Hello, Im a message!")
</syntaxhighlight>Or can be output to the player.log file like this:<syntaxhighlight lang="c#">
UnityEngine.Debug.LogError()
</syntaxhighlight>Or by using other standard UnityEngine.Debug methods, as detailed here[https://docs.unity3d.com/ScriptReference/Debug.html]. Various options for ingame error popups and such can be found in the Debug section of the ingame options.


==Detailed Scripting Topics==
==Detailed Scripting Topics==
Anonymous user

Navigation menu