Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

Reusable Interaction System in Unity in Under 60 ๐Ÿซณ๐Ÿ—ก๏ธ๐Ÿ˜Ž #unitytips #unity3d

15,933 Aufrufe โ€ข vor 2 Jahren โ€ขvia X (Twitter)

10 Kommentare

Profilbild von Hura
Huravor 2 Jahren

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 ๐Ÿ™

Profilbild von Sunny Valley Studio
Sunny Valley Studiovor 2 Jahren

Thanks for sharing ๐Ÿ‘

Profilbild von Distracted Coder
Distracted Codervor 2 Jahren

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

Profilbild von Sunny Valley Studio
Sunny Valley Studiovor 2 Jahren

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.

Profilbild von Mobius Dev-Tech
Mobius Dev-Techvor 2 Jahren

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

Profilbild von Sunny Valley Studio
Sunny Valley Studiovor 2 Jahren

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.

Profilbild von Alex Ameye
Alex Ameyevor 2 Jahren

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

Profilbild von Sunny Valley Studio
Sunny Valley Studiovor 2 Jahren

I explain it here ๐Ÿ™‚

Profilbild von ozn1911
ozn1911vor 2 Jahren

pls tell me how did you quickly add the function there

Profilbild von Mahima Singh
Mahima Singhvor 2 Jahren

Thanks for sharing! Iโ€™ll give this a try

ร„hnliche Videos