Jump to content

Very first steps in plugin dev ... need help/review


Recommended Posts

Hi,

So i know very little about c# and unity (just not to say nothing :) ). Atm my goal is to :

- create an app launcher button present on all scenes.

- Create a window with some buttons on it reacting to the app launcher button.

My script is working. But i dunno if i did things the right way. I have been reading some plugins sources here and there, but most of the time plugin complexity make things quiet difficult to understand/track for me.

here is the link of my main script.

Cause original source is heavily commented to help myself remember/understand things.

Another link without comments.

One question anyway.

Why OnGuiAppLauncherReady is not fired first time on Space Center scene?

is it normal or am i doing something wrong ?

Thanks for any review.

Link to comment
Share on other sites

One question anyway.

Why OnGuiAppLauncherReady is not fired first time on Space Center scene?

is it normal or am i doing something wrong ?

I haven't looked at the Space Center scene specifically, but it looks like OnGuiAppLauncherReady doesn't fire when it used to. Your best bet now seems to be to create the button in Start() and as far as I can tell, the app launcher is ready by then.

Link to comment
Share on other sites

In the KF plugin, after a few hundred different attempts at making it work, all we ended up with was this in the Awake() method:


[COLOR=#004085]GameEvents[/COLOR].[I]onGUIApplicationLauncherReady[/I].[COLOR=#191970][B]Add[/B][/COLOR]([COLOR=#191970][B]OnGUIReady[/B][/COLOR]);
[COLOR=#004085]GameEvents[/COLOR].[I]onGUIApplicationLauncherUnreadifying[/I].[COLOR=#191970][B]Add[/B][/COLOR]([COLOR=#191970][B]OnGUIUnready[/B][/COLOR]);

With OnGUIReady and OnGUIUnready both being custom methods that either add the button or remove it.

So far it seems relatively stable. Haven't experienced any duplicate icons for quite some time either, but then we have extensive checks for that sort of thing in other areas of the mod since we render our button in every scene I think.

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