Skip to content

u/epoHless

In this archive from Oct 2020 to Dec 2024

1
posts
14
comments
5
media
129
score
1 saved before deletion

Top posts

Top comments

You'll have to create an interaction component class and interface IInteractable.

In the interface create a method called OnInteraction() and implement this interface on the needed classes.

On the interaction component create a method Interact and have it shoot a raycast when you press a certain button in the direction you're looking, with the TryGetComponent method on the hit variable of the raycast look for an IInteractable interface, if found, execute the OnInteraction() method.

This os as far as i can help from mobile. Look into the documentation of Physics2D.Raycast and TryGetComponent if needed.

Best of luck!

4 points

Subreddits

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.