Skip to content
This repository has been archived by the owner on Nov 7, 2022. It is now read-only.

Urho3D view is wrong size with iOS 14 #408

Open
btschumy opened this issue Sep 17, 2020 · 2 comments
Open

Urho3D view is wrong size with iOS 14 #408

btschumy opened this issue Sep 17, 2020 · 2 comments

Comments

@btschumy
Copy link

btschumy commented Sep 17, 2020

With the new release of iOS 14, I'm finding the Urho drawing surface is 1/3 the size it should be. the actual UrhoSurface is the correct size, but the rendered scene is incorrect. In the attached image I've set the background color of the UrhoSurface to be red. As you can seem the UrhoSurface occupies the correct size, but the Scene is 1/3 size, centered in the view. This has worked fine on earlier iOS releases.

Possibly there is something I'm doing incorrectly, but I don't see any API to control the size of the scene within the UrhoSurface.

IMG_0909

This is a pretty critical issue, so some attention would be appreciated.

@btschumy
Copy link
Author

It does look like the FormsSample app does get created at the correct size. I did create my app using that as a template, but maybe there is something slightly different between how the two create the Urho Application. I will dig into this and try to track it down.

@btschumy
Copy link
Author

Okay, I've found a workaround for this. In the example FormsSample application, the app is launched and the first Page is a screen with a button to click to show the page with the UrhoApp. That made me think it could be some sort of timing problem.

In my app, the MainPage that is first shown contains the UrhoApp. It was started as follows:

	protected override void OnAppearing()
	{
		base.OnAppearing();
		StartUrhoApp();
	}

This results in the too small UrhoApp view. It looks like you need to delay the creation of the UrhoApp slightly. If I change the code to:

	protected override void OnAppearing()
	{
		base.OnAppearing();
		
		Device.StartTimer(TimeSpan.FromMilliseconds(1), () =>
		{
			StartUrhoApp();
			return false;
		});
	}

Then it is created at the correct size. Apple must have changed something in iOS 14 that means the view is not the correct size at the time OnAppearing is called.

I do consider this a bug and it will likely bite most folks. I do have a reasonable workaround though.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant