Skip navigation
Reusable Interaction System in Unity in Under 60
0:00 / 0:58

Reusable Interaction System in Unity in Under 60

Sunny Valley Studio

@SunnyVStudio6.5K followers

Visit on X
346 likesDownloadOriginal post

15,958 views #unitytips #unity3d

Reusable Interaction System in Unity in Under 60 🫳🗡️😎 #unitytips #unity3d

10 Comments

Comments from the original post on X (Twitter)

  • Hura's profile picture

    @Huraleur

    Don't forget to cast your interface to UnityEngine.Object when checking for null. If not, you'll have some crazy moments 👀. The video doesn't do null checks so it doesn't apply but it's nice to know 🙏

    3 likes

  • Sunny Valley Studio's profile picture

    @SunnyVStudio

    Thanks for sharing 👍

  • Distracted Coder's profile picture

    @DistractedDevYT

    Hah I usually use SendMessage for stuff like this. Good to know there’s a better way

    1 like

  • Sunny Valley Studio's profile picture

    @SunnyVStudio

    Yeah c# is staticly typed so I would recommend using interfaces. On the other hand if you work in Godot in GDScript (dynamic language) sending messages is a default way. It is super cool but the tradeoff is there is no error checking done by the compiler.

    1 like

  • Mobius Dev-Tech's profile picture

    @dev_mobius

    This is an example of abstraction right? It's quite powerful thanks for sharing.

    1 like

  • Sunny Valley Studio's profile picture

    @SunnyVStudio

    Technically i believe it is an example of implementing polymorphism through interface implementation. You do abstract out the concept of "interactable" object by defining a common method (interface) to be called.

    1 like

  • Alex Ameye's profile picture

    @alexanderameye

    Nice! How are the selection outlines rendered? Extruding the vertices?

  • Sunny Valley Studio's profile picture

    @SunnyVStudio

    I explain it here 🙂

  • ozn1911's profile picture

    @ozn1911

    pls tell me how did you quickly add the function there

  • Mahima Singh's profile picture

    @MahimaSing52653

    Thanks for sharing! I’ll give this a try