Forum rules - please read before posting.

Two strange issues regarding hotspots and screen size

Hi!
I'm writing because I've stumbled upon a couple of strange issues. I think they might be bugs, because they happened all of a sudden, without me changing anything.

1) My game's backgrounds are 1280x720. When I created the scene, I set the main camera size to 3.6 and its Viewport Rect to W=1 / H=0.965 , so that the white rectangle that is the camera view embraces the background perfectly. Today, without manking any changes, I've discovered that for some reason these values do not fit the background anymore. The background size is still 1280x720, the Viewport Rect values and Camera size are the same, but for some reason now the white rectangle around the scene looks bigger than the background. I have to manually change the Viewport Rect H value to make it fit again with the background. This happened in all of my project's scenes as well.
Is that a bug, or is there some value that needs to be changed?

2) I've got an issue with a hotspot which apparently doesn't want to work where it is anymore.
The setting is a key in a drawer.
I set the key's hotspot "Off on start" with a Remember Hotspot component. Then, in the actionlist of the drawer's hotspot, I put "Enable hotspot" for the key hotspot, so that the key hotspot becomes active when the drawer is opened. At the beginning, it worked: I opened the drawer, the hotspot became active (and the key sprite was displayed), and by clicking on the key I added it to my inventory and made the key's hotspot disappear to an off-screen 2d marker (as taught in a tutorial).
After trying this dynamic I stopped the game and went on working on other hotspots, unrelated to these ones. When I ran the game to test the new hotspots I made, I discovered that the "key in drawer" hotspot doesn't work anymore: when the drawer is clicked, the key sprite becomes visible, the hotspot becomes active (I've checked the inspector during gameplay), but clicking on it does nothing.
The strange thing is that at the beginning it worked perfectly!
Now the key hotspot works only if I move it away from the drawer. At first I thought that there might have been a conflict between hotspots, but if that was the case, it shouldn't have worked from the beginning. Same question as before: is this a bug, or do I need to change something?

Comments

  • P.s.: I've checked the console, and no errors are displayed.

  • 1) In general, you shouldn't have to tinker with the Camera's Viewport Rect - but instead the resolution box at the top of the Game window.

    To keep a fixed aspect ratio regardless of resolution, check Force aspect ratio? in the Settings Manager.

    I'm not totally clear on what you mean by "white rectangle", so if you still have problems it'll be best to share some screenshots.

    2) There isn't enough information here to give exact advice. If the Hotspot is in the correct place (and the Inspector shows both it and its Interactions are enabled), then it likely is a conflict with some other Collider / Trigger in your scene.

    You'll need to work out where that conflict is coming from. Bear in mind it's not just other Hotspots that could cause this - if you have another Collider overlapping it then that may also interfere.

  • Hi!
    Sorry, I didn't see the resolution box at the top of the Game window. I have probably tinkered with the wrong options.
    Now I've set a custom resolution in the resolution box (I've put 1024x768), and I've changed the Viewport Rect values at their original settings. However, after doing that now two stripes appear at the top and the bottom of the game screen (they're of the background color).

    Regarding the hotspots, I've forgot to tell you that in that area there are two hotspots, both of which have a polygon collider 2d, and these polygon colliders are overlapping. Maybe that can be the cause of the problem?

  • About the white rectangle: I think it's the field of view of the main camera when you choose Projection -> Orthographic. If you select "Perspective", that rectangle doesn't show up. I've made a screenshot of it:

    https://imgur.com/IGNmusJ

  • The aspect ratio of 1024x768 does not match that of 1280x720. If they aren't the same, and you're enforcing the aspect ratio, then AC will draw borders to correct it - this is to prevent the camera displaying unwanted areas of the scene.

    If there are two Hotspots overlapping, that'll create a conflict. You can try changing the Z-position so that one is in front of the other - otherwise, which one is interactive may be random, which ties in with the fact that yesterday it seemed to behave.

  • Boy, I really feel stupid now. That's what happens in the morning when you don't sleep well.
    You're right: I've put a game resolution which does not match the resolution of my background. And I didn't even notice it. Now I've corrected it, and it works perfectly: I just had to fix the Camera Size, without tampering with the Viewport Rect, and now the camera fits perfectly, without borders.

    I'll try to change the Z-position to make the key hotspot stand in front of the other, too.

    Thanks again, Chris, and sorry again for the dumb comments!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.