DEV Community

loading...

Discussion on: Implementing the Strategy design pattern using Scriptable Objects in Unity

Collapse
patrykszylin profile image
Patryk Szylin

Player.cs
public void Attack(IAttack attack)
{
attack.Execute(this);
}

How do you pass an attack to this function? Do you use a custom serializer to expose IAttack in the inspector??

Collapse
lyrapuff profile image
Kotori

This is a bit old, but I assume that he just has a parameter of type Attack which is a class that implements ScriptableObject which makes it serializable by Unity.

Forem Open with the Forem app