Jump to content

simple test not working.


Recommended Posts

Hi All,

I\'m not a programmer (at least not for a good few years) but tried the example plugin without success. Heres what I had....

C# express 2010 as per the wiki. Added the two references in as needed.

Put this code in:-

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

/// <summary>
/// My first part!
/// </summary>
public class TestModule : Part
{
/// <summary>
/// Called when the part is started by Unity.
/// </summary>
protected override void onPartStart()
{
// Add stuff to the log
print('something silly to the log');
}
}

It green lined all the way down when i build the solution. a DLL appears in both debug and release directories. I move it to plugins but the line from the print command doesnt appear in the log.

i saw it said 14X1 or greater and mine is the store download v14. do i need an X build to try this or am I missing something?

Regards,

Mat

Link to comment
Share on other sites

6icorr.png

Build it like so, head over to your project folder, obj, release, that\'s the dll you want.

Then make a new part, by simply copying the RCSBlock for example.

// --- general parameters ---
name = loldisispart
module = ModuleNameHere
author = mrprefimz

Change the module name to whatever you set it in the code, TestModule in your case.

Strap the part onto your rocket, hit space, alt+f2

Then 'something silly to the log' should appear there, hopefully this helped.

Link to comment
Share on other sites

Thanks for that.

I added it as a part and it works fine. What threw me was the tutorial says without making it as a part like the rcs block it should just appear in the log file when you load the game. in fact the next stage after doing that is to make it work like a module on the ship.

Link to comment
Share on other sites

Not sure how much it matters, but I include this in all of my headers so I can access the unity engine functions.

using System.Collections;
using UnityEngine;

That sounds like you could make big uh-oh\'s to the game. But what do I know

Link to comment
Share on other sites

Unity Engine is what the game is built on. What I\'m referring to is gaining access to the features of the unity engine. Not the 'operation' parameters of the engine. Unity does not allow modifications of its internal systems. (unless you have a source code license, and they are very expensive)...

So what I\'m referring to is perfectly safe. Considering you have access to c# and .net. That is much more likely to cause issues with bad programming then using the unity engine. I give it a few days before someone programs a seg-fault into a script. :)

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...