playMaker

Author Topic: isShowingSplashScreen (unity 5.2)  (Read 5297 times)

moondust.games

  • Playmaker Newbie
  • *
  • Posts: 46
isShowingSplashScreen (unity 5.2)
« on: October 14, 2015, 01:30:11 PM »
New in Unity 5.2 is the ability to check if Unity is showing a splash screen. This is following a bug I reported to them.

Previously there was no way to know and the first scene would load behind the Unity Personal edition splash. If that scene was short (like a branding page) then the next scene would load and after the Unity splash it was already in the game without the first scene ever showing.

Would you be able to write a custom action that checks against this please? I assume it would check every frame and then can do an action when it's false i.e. not showing a splash.

http://docs.unity3d.com/ScriptReference/Application-isShowingSplashScreen.html

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: isShowingSplashScreen (unity 5.2)
« Reply #1 on: October 14, 2015, 04:25:16 PM »
Hi,
i don't have a Computer here with 5.2 on it so i can not test this.
Can you try if this works?

and let me know if it works so i can add it to the EcoSystem
« Last Edit: October 15, 2015, 02:47:48 PM by djaydino »

moondust.games

  • Playmaker Newbie
  • *
  • Posts: 46
Re: isShowingSplashScreen (unity 5.2)
« Reply #2 on: October 14, 2015, 07:37:32 PM »
Hi djaydino - thanks a lot. It does indeed work :D

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: isShowingSplashScreen (unity 5.2)
« Reply #3 on: October 15, 2015, 01:30:07 AM »
Hi,

 one thing before you put it on the ecosystem, make sure you put some compiler flag for the action to fail silently when less than Unity 5.2, like
Code: [Select]
#if !UNITY_5_0 & !UNITY5_1
Bye,

 Jean

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: isShowingSplashScreen (unity 5.2)
« Reply #4 on: October 15, 2015, 02:56:59 PM »
Hi Jean,
i made it like this :
Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2015. All rights reserved.
/*--- __ECO__ __PLAYMAKER__ __ACTION__ ---*/
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Application)]
[Tooltip("Sends Events if Is Showing Splash Screen or not")]
public class IsShowingSplashScreen : FsmStateAction
{
        [Tooltip("Event to send if is Showing Splash Screen is True.")]
public FsmEvent isTrue;

        [Tooltip("Event to send if is Showing Splash Screen is false.")]
public FsmEvent isFalse;

        [Tooltip("Repeat every frame while the state is active.")]
public bool everyFrame;

public override void Reset()
{
isTrue = null;
isFalse = null;
everyFrame = false;
}

public override void OnEnter()
{
#if !UNITY_5_0 && !UNITY_5_1
Fsm.Event(Application.isShowingSplashScreen ? isTrue : isFalse);
#else
Debug.Log("This Action only works on Unity 5.2 and upwards");
#endif

if (!everyFrame)
{
    Finish();
}
}

public override void OnUpdate()
{
#if !UNITY_5_0 && !UNITY_5_1
Fsm.Event(Application.isShowingSplashScreen ? isTrue : isFalse);
#else
Debug.Log("This Action only works on Unity 5.2 and upwards");
Finish();
#endif
}
}
}

is this ok?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: isShowingSplashScreen (unity 5.2)
« Reply #5 on: October 16, 2015, 07:27:07 AM »
Hi,

 yep, that works.

Bye,

 Jean

SushimojiTo

  • Playmaker Newbie
  • *
  • Posts: 6
Re: isShowingSplashScreen (unity 5.2)
« Reply #6 on: March 14, 2016, 12:42:57 PM »
Hi,
this is very usefull.  ;D

I must to use this action in my project.
How can I find it in Ecosystem?
I've try to search some words relative to this action but I don't find anithing.

Thanks a lot.  :)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: isShowingSplashScreen (unity 5.2)
« Reply #7 on: March 14, 2016, 02:39:29 PM »
Hi,
Sorry about that..... i forgot to place it on the EcoSystem,,,,  :-[

It can be found now on the EcoSystem :)

Could you confirm if it works properly.

SushimojiTo

  • Playmaker Newbie
  • *
  • Posts: 6
Re: isShowingSplashScreen (unity 5.2)
« Reply #8 on: March 14, 2016, 08:34:09 PM »
Thanks!  :D

It works very well! ;)