I'm trying to run my C# script, but for it to load only during gameplay (e.g after clicking on New Game, or Continue). Is this possible?
Basically, run a C# script as soon as game enters the gameplay
I'm trying to run my C# script, but for it to load only during gameplay (e.g after clicking on New Game, or Continue). Is this possible?
Basically, run a C# script as soon as game enters the gameplay
I'm trying to run my C# script, but for it to load only during gameplay (e.g after clicking on New Game, or Continue). Is this possible?
Basically, run a C# script as soon as game enters the gameplay
Some simple C# script that I need for it to start in gameplay mode
Code: Select all
using System.Collections;
using System.Collections.Generic;
using Naninovel;
using UnityEngine;
public class Clock : MonoBehaviour
{
string Date_Month;
string Date_Day;
string Date_Time_Hours;
string Date_Time_Minutes;
string Date_Time_Seconds;
// Start is called before the first frame update
void Start()
{
Debug.Log("Started on gameplay");
}
// Update is called once per frame
void Update()
{
}
}
Consider using the OnStart and OnStop events in IScriptPlayer. https://naninovel.com/guide/engine-serv ... e-services
idaot wrote: ↑16 Oct 2022 08:28Consider using the OnStart and OnStop events in IScriptPlayer. https://naninovel.com/guide/engine-serv ... e-services
I've looked through the post up and down, I see no reference to a OnStart and OnStop events anywhere
And I'm still confused on how to implement this
As the guide states, there are multiple engine services with which you can interact with, in your case it's IScriptPlayer.cs. Search the codebase for examples where OnStart and OnStop is being used within the engine.
I've looked through the link multiple times. Also checked out https://naninovel.com/guide/integration ... ialization
No sign of any OnStart/OnStop event
I've even googled it, and looked through this forum's search box. No results
Searching the codebase means using IDE tools to look for something in the source code, not googling or using forums. Most of the public APIs in Naninovel are documented and you can learn a lot by analyzing how they are used internally.
To be more specific..
-- When making a custom UI and attaching a script onto the UI, how can I make it where the script update
is ran only when the UI is "shown" and stop running when "hidden"
Use the OnShow() or OnHide() events found on the root of the prefab or listen to the HandleVisibilityChanged event in C#.