-
Notifications
You must be signed in to change notification settings - Fork 12
Scriptable Architecture
DucNV_2000 edited this page Feb 27, 2024
·
21 revisions
Scriptable Objects are an immensely powerful yet often underutilized feature of Unity. Learn how to get the most out of this versatile data structure and build more extensible systems and data patterns.
Introductory video about Game Architecture with Scriptable Objects
You can create Scriptable Event
by 3 option
- Option 1: via menu
Create
>Sunflower
>Scriptable
>Event
- Option 2: menu item
Sunflower
>Scriptable
>Create Event
- Option 3: Open tab
Scriptable Event
inSunflower Control Panel
- Scriptable Event no parameter
- Scriptable Event has parameter (int, float, string, bool, vector3,...)
You can raise events by code or by the inspector (Enable Debug Field
> button Raise Event
)
- Raise by code
public class Player : MonoBehaviour
{
public EventNoParam playerAttackEvent;
public void Attack()
{
playerAttackEvent.Raise();
}
}
- Raise by inspector (
Enable Debug Field
> buttonRaise Event
)
You can listener event by component Event Listener
or by code
- Listener by component
- Listener by code