Forum rules - please read before posting.

Use Interaction Not Working in 2D First Person Game

Hi Chris,

I'm trying to get my interaction menu working in a 2D First Person game. I have watched your tutorial on creating a first person game, as well as most of your 2D game tutorial. I have scoured the forums here extensively and have come up empty handed.

Here You say that creating a player or a NavMesh is unnecessary in a first person 2D game. So I have left these sections blank in the scene settings. However, I get the error messages "No Player Found" and "Could not initialize NavMesh" when I run the game, so I'm wondering if this is having an influence on the interactions not working.

I have basically followed the exact setup for a typical 2D game, except I have left out a player and a NavMesh. I have created a Hotspot and added a Use interaction, then edited the ActionList for the interaction to switch to the next scene. When I run the game, the interaction menu appears and the Use option is highlighted, but when I click nothing happens.

It seems like there should be nothing more to it. All I want is to be able to switch to the next scene when I hover over the Hotspot and click on the Use icon.

I apologize if I am not getting this across clearly as I have been problem solving all day and my mind is basically mush at this point.

If there's any info I have left out that would be useful, let me know! Also, if you would like to see screenshots of my various settings and parameters I can get you those as well.

Would appreciate any help you (or anyone) is willing to give. Seems like this should be so simple!

Best,

Max

Comments

  • The process shouldn't be much more than that, certainly.

    The NavMesh and Player system are both independent of the interaction system - you can ignore those so far as this problem goes.

    Have you added both scenes to Unity's Build Settings? Apologies if that's obvious, but that's the first thing I have to suggest based on what you've described.

    Otherwise, try running the Interaction ActionList manually - you can do this by clicking the "Run now" button in its Inspector at runtime. If it works, then the issue will be to do with how the Hotspot / Interaction menu is set up. Are you using the default interface?

    If it doesn't work, then the issue will be to do with the Actions. You can try inserting an ActionList: Comment Action into it, and have it it display a message in the Console, to check that the Actions themselves are running. Otherwise, let's see some screens of the setup, as well as Unity/AC version numbers, and we'll try to see what's what.

  • Hi Chris,

    Sorry for the delayed response. I like to go through everything with a fine tooth comb, trying out absolutely every possibility I can think of before getting back to you, so as to hopefully waste as little of your time as possible. Speaking of which, in doing so, I inadvertently solved the problem, and I can't for the life of me figure out how.

    In any case, I'm sure something you said nudged me in the right direction. It was definitely helpful to know I didn't need to worry about a NavMesh or a Player and was able to safely rule that out from the start.

    Many thanks again to you for your thoroughness and immediacy in answering my questions.

    I'm sure I will be back here with more for you soon!

  • edited October 2020

    Hello Max,

    I'm running into what I think is the exact same problem and after hours of searching I have yet to find a solution, though thankfully I ran into your post! I am also working on a First Person 2D game and removed the NavMesh and Player.

    Was wondering if you were able to figure out what you did to make the interaction work to switch the scene? I made sure to add both scenes in the build settings as Chris mentioned, but still no dice.

    One thing I noticed is the "run now" button in the inspector tab is greyed out, not sure why.

    I created a 2D hotspot and interaction. Action type is Scene/Switch and using choose scene by number, which matches the numbers shown in the build settings.

    Looking forward to your response since you seem to have encountered the same issue!

    Thanks in advance!

    Ian

    EDIT: So after reading Chris' comment repeatedly I noticed the "run now" button was greyed out because the game was not running, duh! However, the scene still did not change while clicking.

    This led me to fiddle in the inspector tab and I noticed I never set the Hotspot use interactions. Once I linked the Hotspot interaction I was able to switch scenes by clicking.

    If anyone runs into a similar issue make sure to check all the Hotspot settings in the inspector tab and confirm all scenes are checked in the build settings!

    Thank you Chris for pointing us in the right direction! :)

  • Welcome to the community, @ilinz97.

    I recommend taking a look through the Interactivity tutorials if you haven't already, as they cover the key aspects related to Hotspots and interactions. Though the tutorials themselves are in 3D, the principles apply to 2D games as well.

  • Greetings, ilinz97!

    Sorry for just now seeing your comment. Good to know you pretty much came to your own conclusion as well, with Chris nudging us both sagely in the right direction, of course.

    Be well sir! ;)

    Which brings me to the reason I popped back on these forums again.

    Chris,

    Hope your holidays were splendid and life is mostly grand. Diving back into the game again I've decided to go with a slightly different approach to the interaction system.

    I want to have it so you can say, move the cursor near the top of the screen and a "forward" icon appears (in this case, a hand pointing ahead). Then when you move the cursor to the bottom of the screen, a "Back" icon appears. The same goes for left and right.

    I have tried to implement this in a very hap-hazard way--namely by making an endless array of new menus with only one button that trigger a switch to a particular scene, and then hiding these menus once I create a new scene and only wish to have the most recent set of icons available. As you can guess, this already a complete mess. There's definitely an easier way, right?

    I've tried to simply add these new elements to the original Interaction menu, but they don't show up in the Inspector window as an option for Use interactions on my Hotspot. Is there a way to do this /or create a new Interaction menu that I can link to my Hotspot? Do I need to learn some fancy coding?

    Is any of this making sense?

    Thanks!

    As always, your input, or anyone else's is deeply appreciated.

  • What should occur when clicking while the forward/back icon shows? To change scene, or just camera?

    Interaction icons are defined in the Cursor Manager - this is where the list of available icons comes from when defining a Hotspot interaction. Each of the Interaction elements in your Menu need to be linked to an icon defined in the Cursor Manager. If you want to update your Interaction menu, first create a new icon in the Cursor Manager, and then create a new Interaction element in your Menu which is linked to this new icon.

    To simply change the cursor's appearance, however, you needn't add the icon to the Interaction menu. You can have the cursor change icon when over a given portion of the screen in one of two ways:

    1. Position a Hotspot over that portion of the screen, and check Single 'Use' interaction?. This will cause the Hotspot to use a one-click interface, so that you can have the cursor change to the supplied icon when hovering over it. No Interaction menu will be involved - clicking on the Hotspot will run its Interaction immediately.
    2. Create a new Menu that covers that portion of the screen, create a Button element inside that Menu, and check Change cursor when over? in its properties.

    The second is a bit more complicated as you'll have to rely on an ActionList asset (when clicking the Button) to then run an ActionList in your scene (to switch scene/camera). I'd recommend the first unless you have need to use the second, though your interface does sound a little similar to that of the "Movement template: 2D First person" package over on the Downloads page.

  • For now, just a scene switch, but I think I got it solved.

    This was incredibly helpful, Chris. Thanks for saving the day yet again. I went ahead and went forward with the first method, and this worked so well I see no reason to try anything else. Pretty much exactly as imagined. Now I’ll go about deleting all these pesky menus.

    Cheers!

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.