Je suis en train de créer des tutos (bouton Training dans l'IHM de KSP) pour KSP 1.2.2 et je rencontre la difficulté suivante : les popups avec Gene Kerman, notre instructeur, n'apparaissent pas.
Le code source de ma classe :
Code : Tout sélectionner
using UnityEngine;
namespace RSSROTutorial
{
public class RSSROTutorial101 : TutorialScenario
{
TutorialPage welcome, conclusion;
protected override void OnAssetSetup()
{
instructorPrefabName = "Instructor_Gene";
}
protected override void OnTutorialSetup()
{
ScreenMessages.PostScreenMessage("GOGOGO !!!");
welcome = new TutorialPage("welcome");
welcome.windowTitle = "Orbiting 101";
welcome.OnEnter = (KFSMState st) =>
{
instructor.StopRepeatingEmote();
//InputLockManager.SetControlLock((ControlTypes.STAGING | ControlTypes.THROTTLE), "RSSROTutorial101Lock");
};
welcome.OnDrawContent = () =>
{
GUILayout.Label("Salut !!!", GUILayout.ExpandHeight(true));
if (GUILayout.Button("Next")) Tutorial.GoToNextPage();
};
Tutorial.AddPage(welcome);
conclusion = new TutorialPage("conclusion");
conclusion.windowTitle = "Orbiting 101 - Complete!";
conclusion.OnEnter = (KFSMState st) =>
{
instructor.PlayEmote(instructor.anim_true_smileB);
};
conclusion.OnDrawContent = () =>
{
GUILayout.Label("Salut encore !!!");
if (GUILayout.Button("Finish"))
{
Destroy(this);
}
};
Tutorial.AddPage(conclusion);
Tutorial.StartTutorial(welcome);
}
}
}
Code : Tout sélectionner
[EXC 02:16:32.947] ArgumentException: You can only call GUI functions from inside OnGUI.
UnityEngine.GUIUtility.CheckOnGUI ()
UnityEngine.GUI.get_skin ()
UnityEngine.GUILayout.Label (System.String text, UnityEngine.GUILayoutOption[] options)
RSSROTutorial.RSSROTutorial101.<OnTutorialSetup>b__3_1 ()
TutorialScenario.Update ()
http://forum.kerbalspaceprogram.com/ind ... -code-r13/
https://github.com/ilo/KSP-TrainingTuto ... lPlugin.cs
En revanche, j'ai essayé le code tout bête ci-dessous, et là, ça marche nickel mais ce n'est pas le texte que je veux bien sûr (TutorialOrbit101 est une sous-classe de TutorialScenario et décrit un tutoriel de mise en orbite il me semble) :
Code : Tout sélectionner
using UnityEngine;
namespace RSSROTutorial
{
public class RSSROTutorial101 : TutorialOrbit101
{
}
}

Merci par avance pour l'aide que vous pourrez m'apporter.