Jump to content

My first plugin not work


Recommended Posts

Hi, i am learning write plugins to KSP and i have problem :C

this code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

namespace ClassLibrary2
{


public class TestModule : PartModule
{

public override void OnStart(StartState state)
{
// Add stuff to the log
print("something silly to the log");
}
public void Awake() { }
public void Start()
{
print("Holy Sh*t the plugin started correctly!!");
}
}
}

not work.

I can't find :"Holy Sh*t the plugin started correctly!!" or "something silly to the log" in output_log.txt. What is wrong?

Link to comment
Share on other sites

As with what UbioZur said,

If it's a NON-PART plugin, change

public class TestModule : PartModule

to

public class TestModule : MonoBehavior

Also, this is very useful, give it a watch :)

Try this and see if you get a result:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using KSP.IO;

namespace ClassLibrary2
{


public class TestModule : MonoBehavior
{
[KSPAddon(KSPAddon.Startup.Flight, false)] // or .Startup.MainMenu or .Startup.EveryScene
public void OnStart()
{
// Add stuff to the log
print("something silly to the log");
}
public void Awake() { }
public void Start()
{
print("Holy Sh*t the plugin started correctly!!");
}
}
}

Edited by noonespecial
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...