Forum rules - please read before posting.

Mouse Scroll Movement

My goal is to create a 2D game, without a player, that acts like a webpage.

I'm currently stuck trying to find a way to add a mousewheel scroll function, so I can browse up and down the "webpage".

Is there a way that I will be able to do this?

Comments

  • edited November 5

    Welcome to the community, @LukeWarme.

    There are a couple of ways you could go about this.

    One would be to have your webpage be a full-screen UI Canvas, so that you can use Unity's built-in ScrollWheel component that reacts to the mouse-wheel.

    The other, which would avoid the use of UI, would be to attach a custom script to your camera that moves vertically based on the mouse-wheel input. If you use the Scene Manager to create a "Stationary" camera, you can affect its position using a custom script while still having it be listed in AC's various Camera fields/Actions.

    Which approach sounds best in your situation?

  • I think the fullscreen UI canvas would be the most useful, how would one go about implementing this? (also thank you)

  • You can create UI Canvases from the GameObject menu in the top toolbar. Details on working with Unity's UI system can be found here.

    When it comes to having AC work with UI, you create Menus in the Menu Manager, add elements such as Buttons that you wish for AC to work with, and then link them to your UI prefab.

    The Manual's "Menus overview" chapter has details on how AC's Menu system works, and this tutorial covers the process of linking it to Unity UI. The Scroll View component (sorry, not ScrollWheel), is a Unity component, and doesn't need linking with AC.

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.