Jump to content

How to add a splash screen with C#?


photo

Recommended Posts

I didn't find "Unigine.Splash" API in C# development environment, and the document only says "how to skip the splash screen". I searched on forum, but they use C++, I don't how to write C# code to implement it. I know Community SDK can't skip the Unigine's splash screen, but how to add my own splash screen after the Unigine's?

Link to comment

lgdnpt

There are 3 different types of "splash" screens, you can find how to customize each of it in the documentation below:

To see the C# examples you need to switch language in API (top right corner):

image.png

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
6 hours ago, silent said:

lgdnpt

There are 3 different types of "splash" screens, you can find how to customize each of it in the documentation below:

To see the C# examples you need to switch language in API (top right corner):

image.png

Thanks for your reply! But the document don't say how to customize the startup splash, it only says how to skip it, I need to add my logo as a splash. "Start game→unigine's logo→my logo→main menu" that's my thought.

Link to comment

Hello @lgdnpt!

There is no support for custom splash screens out of the box so you'll need to implement it yourself via C# API.

I think the most straightforward way is to draw the screen in the System Logic initialization before any world is loaded and right after the default splash is shown.

Here you can try this simple implementation that uses a WidgetSpriteVideo to draw a video asset (only .ogv videos are supported). Add the MySplash class to source folder and your project/solution and use it like so in the AppSystemLogic.cs:

// AppSystemLogic.cs

private MySplash splash;

public override bool Init()
{
	splash = new MySplash("splash/logo.ogv", new ivec2(400, 225), OnSplashFinished);
	return true;
}

private void OnSplashFinished()
{
	splash = null;
	World.LoadWorld("main_menu_world");
}

But make sure you don't load any world on application startup (there are no world_load command-line arguments and the boot config doesn't define the starting_world).

Other than using a WidgetSpriteVideo, you can draw anything you need (e.g., a textured quad for a static logo) manually by means of the Ffp class (low-level painting) or by using the Texture.Render2D method, but this way is going to be a little harder (you can see an example of drawing via Ffp in this quick videoguide).

Hope this is helpful,

Thanks!

MySplash.cs

  • Like 2
Link to comment
22 hours ago, thomalex said:

Hello @lgdnpt!

There is no support for custom splash screens out of the box so you'll need to implement it yourself via C# API.

I think the most straightforward way is to draw the screen in the System Logic initialization before any world is loaded and right after the default splash is shown.

Here you can try this simple implementation that uses a WidgetSpriteVideo to draw a video asset (only .ogv videos are supported). Add the MySplash class to source folder and your project/solution and use it like so in the AppSystemLogic.cs:

// AppSystemLogic.cs

private MySplash splash;

public override bool Init()
{
	splash = new MySplash("splash/logo.ogv", new ivec2(400, 225), OnSplashFinished);
	return true;
}

private void OnSplashFinished()
{
	splash = null;
	World.LoadWorld("main_menu_world");
}

But make sure you don't load any world on application startup (there are no world_load command-line arguments and the boot config doesn't define the starting_world).

Other than using a WidgetSpriteVideo, you can draw anything you need (e.g., a textured quad for a static logo) manually by means of the Ffp class (low-level painting) or by using the Texture.Render2D method, but this way is going to be a little harder (you can see an example of drawing via Ffp in this quick videoguide).

Hope this is helpful,

Thanks!

MySplash.cs 1.21 kB · 0 downloads

Thank you!

Link to comment
×
×
  • Create New...