Download

HELP with Actor spawning according to android screen size?

So there’s A LOT of androids out there with different screen size. My friends, my family, and I have mostly large screened phones. In my app 2D actors start spawning on the screen and they grow larger and larger as time passes. I have a Bp that’ll detect the screen size and spawn the actors in that screen without overlapping and spawning out of bounce. I have the total amount actor spawning to max 5. This work perfectly and tested it on multiple large screen devices and it works fine. However here’s my problem, when I test my phone on small screen devices such as 1280 x 720 or 960 x 540 or any screen with a 720p resolution display or lower (from what i tested) it only spawns 2 actors max. There’s nothing wrong with my bp, but how do i make it so it spawns all 5 actors on small screens as well. I posted this in the android development section but no ones answering or know the problem so i’m posting here if anyone knows the problem. If anyone could provide a solution or tell me what nodes to put to fix this problem that’ll be greatly appreciated. I don’t want to release a half working app where users with small screens can’t play my game. Thanks!

My BP: http://i.imgur.com/mPBqdPI.png

Does anyone have a clue? This is seriously holding me back.

Have you tried to draw debug boxes based on your math there? It could help you figure out where the dimensions are and what you may need to change in your math. This may be a longshot, but UMG has anchoring functionality along with variable screen resolution functionality. You could maybe overlay a blank UMG widget with an anchor in the center and use the anchor center point as the origin for the spawning area. You might have to convert Screen Space to World Space to make it work right, but UE4 has functionality for that built in. Check out this part of this video that talks about anchors and screen resolution. https://youtu.be/9-h2lQLs8Tk?t=15m29s.

Dont think that’s gonna work or maybe I have no idea what your talking about, but I have 2 actors. One is the spawner witch is placed manually in the world. The other actor is the game object with gets spawned by the first actor. The game object actor is just has the growing Bp. The spawning actor has the bp of the variables i put to determine where to spawn the gaming object actor as shown in the above Bp. Thanks for your help though. I asked this question on answerHub, here, android development, and reddit and not a SINGLE reply. So I guess no one knows my problem. Worst goes to show then I’ll have to release my app that only plays on 1080p phones.

Draw Debug Box. You can draw debug boxes around your spawner based on your spawn area math. Then you can try adjusting your math to fit all screen sizes. You are on the right track, but your math must be wrong.

Is there a tutorial explaining And implaminting debyg boxes? Sorry i dont have a clue about debug boxes. According to my math it works perfectly and EXACTLY how i want it in 1080p screens, but 720p and below it doesnt work.

I am sure there is (Google). You can use a Draw Debug Object almost anywhere. Try it out by creating a test blueprint, set some values for it, and drag it in to your scene - The effects will be more noticeable on a moving object. Typically its something you want to use Event Tick for so it keeps drawing the debug box. Just make sure to remove your debug boxes when you are done using them for testing.

sorry I tried it out and it doesn’t work.

You need to use the debug box to determine your spawn area and adjust your math so that things only spawn within the correct area. If you are spawning within a sphere, there is a debug sphere you can use. I will try to throw a tutorial together this weekend or something if you need.

Ok I finally got it working thank you very much. However, it would be best to put a tutorial on the debug boxes because of the lack of information and tutorials online. If anyone was having the same problem as I than a tutorial would be amazing for them.