<Unity> IsPointerOverGameobject mobile not working - user-interface

I'm making a game in the srpg genre.
I wanted to prevent the game screen from being pressed while the screen is covered.
IsPointerOverGameobject function doesn't work on mobile.
private void Update()
{
if (EventSystem.current.IsPointerOverGameObjet())
return;
if (Input.GetMouseButtonDown(0))
Select();
}
I tried to prevent clicking using IsPointerOverGameObjet() .
It works in the editor and PC build, but strangely doesn't work in Android build.

Related

Lottie Splash Screen on Flutter

I want to add a Lottie animation for a splash screen before any content launches in my Flutter app. The plugins I've checked out don't completely support all features of the animations yet or don't work as desired.
Is there some way I can add it before the actual flutter activity launches. I want the animation to completely finish, and only then go forward to the main content.
Any help appreciated, thanks!
Currently the Lottie plugins for Flutter do not work that well (hopefully they are improved soon) but what I did for my app is save the animation as a .gif (set repeat to once) which can then natively be displayed in an ImageView, then use a timer to move to the next screen one the animation has finished.
Not the ideal solution but a work around until the plugins have been improved.
You can use lottie plugin. lottie: ^0.7.0+1
And then use status listener provided by AnimationController.
Code below:
_controller = AnimationController(vsync: this)
..addStatusListener((status) {
if(status == AnimationStatus.completed){
//Move to next page
}

Play/Pause button on the apple tv remote is not working while the video is playing with AVPlayerViewController

I am playing the video through AVPlayerViewController in tvOS (Xamarin tvOS). I am pausing and resuming the video with Play/Pause button on the apple tv remote. I am using the PressesBegan method to get the event on click of Play/Pause button. This is working fine on the simulator but not on the actual devices. On the actual devices, we are not getting the events for pressing the Play/Pause button. We tried it on Apple TV 4K (version 12.11) and Apple TV (version 11.4).
This is only happening when I play the video through AVPlayerViewController otherwise it works fine. I tried UITapGestureRecognizer, PressesEnded method, and also the RemoteControlReceived method. But still, there is no help. Any help will be much appreciated.
https://github.com/lewixlabs/TvOS-PlayBack-Sample-App/blob/master/TvOS%20PlayBack%20Sample%20App/ViewController.cs
Your app will not receive Pause (or Play/Pause) button events when playing video. This is expected--and documented--behavior. The system redirects the action to the "Now Playing" app's handler (which is AVPlayerViewController in this case).
You didn't say why you were trying to intercept Play/Pause...
If you're trying to disable pausing, you should take a different approach; for example, you could disable user interaction on the root view of the AVPlayerViewController (this disables not just play/pause but pretty much all controls). You could also disable the playback controls. Remember that there are multiple ways for a user to pause, including clicking the touch surface, or using a different type of remote or telling Siri to "pause," neither of which will result in regular pause button events.
If you're trying to determine when the video is paused, you could key-value observe the "rate" property of the player (the rate could also to change to zero for other reasons, e.g. because playback reached the end).
Add a UITapGestureRecognizer to ViewController and allow the UIPressType.PlayPause press type.
var tap = new UITapGestureRecognizer(() =>
{
Console.WriteLine("Remote PlayPause button pressed");
})
{
AllowedPressTypes = new NSNumber[] { new NSNumber((long)UIPressType.PlayPause) }
};
this.View.AddGestureRecognizer(tap);

Cannot send QMouseEvent to simulate click inside a flash content in QWebView only under OSX

I'm using Qt5.4.1 for that I need to use WebKit.
I have a QWebView to display webpages. and I have this piece of code to simulate mouse click:
QMouseEvent e(QEvent::MouseButtonPress, pos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
QApplication::sendEvent(webViewWidget, &e);
It works fine on normal webpages. For example it can simulate a click on a link that in google search result page.
It also works fine on Windows for any webpages.
However on Max OSX, I find that it doesn't work within an area that has a flash content. I test with many random online flash games trying to simulate click inside the game. But it doesn't work. The mouse did move to the destination position that I can observe the hover animation (of a flash game button) is on. But it never trigger the click of that button.
The exactly same code works on Windows for the same game.
I also tried to put intervals between the press event and release event, still no hope.
I know this is quite a weird problem but I really want to make this work!

Xamarin forms Android app verison goes blackscreen randomly

I got this app im been working on i xamarin forms. where i use a ContantPages inside a navigationspage. like shown below
MainPage = new NavigationPage(new SwipePage());
Now when i navigate to a other page like shown below, sometimes the screen goes black. If i then tap out of the app, and then tap in the app, the black screen will disappear, an the page content would be showing. making the app normally again.
this.Navigation.PushAsync(new ProfilPage());
I been trying to see if it's curse i load more data en app start, then resume. but i don't. its getting the same amount of load on resume, as on start.
So do anyone have a idea what it can be, or have tried something similar before?
Thanks for your time,
---UPDATE---
So In a emulator it runs without problems. but when i use a android device IRL it's keep doing that black screen thing.
I think this is occurring because you are not awaiting the async method thus showing a black screen as the page is still rendering but you have already been pushed to the page.
Try using the await operator.
var page = new SwipePage();
await Navigation.PushAsync(page);

LibGDX on resume function

I have issues with OpenGL ES context loss under LibGDX, so I'm trying to figure out how to solve the problem. My first step was to actually re-initialize all my textures when the resume function is called in one my classes that extends Screen. Like this:
#Override
public void resume() {
Tile.initTiles();
}
The resume function re-creates all my tiles (including their textures), so I thought this would work. However, according to the documentation:
ApplicationListener Docs
The resume function should never be called on a desktop. Now, resume is never called on my Android phone, but on my desktop I tell the program to print "true" to the console in the resume method, and voila, the resume function is actually called on the desktop.
My main questions are:
Why would the resume function be called on my desktop but not on my Android phone?
How can I reload my textures on resume for my Android phone? Currently my textures are white on resuming the game after hitting the back key. Interestingly enough the textures reload fine when exiting through the home button.
I'll quickly explain how I do it, and for me it worked out so far without problems on both desktop and Android.
First of all I use an AssetManager for all my assets, including Texture. I usually load all my assets before entering the actual gameplay screen via a loading screen. But it should also work when you load them in your Screen.show() method.
Whenever I need an asset, the only way I retrieve them is via AssetManager.get(...). My AssetManager is actually a public static member of the base game class, so it can be accessed from anywhere in my code and there is only a single one of them.
In my Screen.resume() method I put an AssetManager.finishLoading(), though I'm not sure this is really necessary.
Right after the game starts and your AssetManager is instantiated, I call the static method Texture.setAssetManager(...).
This closes the circle. When on Android your OGL context is lost, LibGDX will actually revive it for you. Since you've set the AssetManager for your Textures, the manager will be able to find the textures after they have been reloaded. The AssetManager.finishLoading() will wait until the reloading has been finished. After that, everything should work as before the context loss.
Why Screen.resume() is not called, I cannot say. For me it is called on Android. Maybe you need to update your LibGDX version.

Resources