Setting instance properties from scene XML

Опубликовано: 29 Сентябрь 2024
на канале: ChillPenguin
47
1

Just a little demo. It's now possible to set properties of script instances with an XML attribute! This is useful when multiple copies of the same script should be created with different properties (for example, a shooter with multiple types of weapon could have a "projectile" script attached to actors in Bullet and Missile scenes, and these scenes could give different values for "Speed", "Damage", "Gravity" properties etc).
For anyone familiar with Unity, this is like exposing properties to the inspector in Unity's editor, compared to editing the value in the .cs script file.
Will make a proper demo for this soon, replacing the "LittleActor" game controller with 2 "Paddle" actors, which have properties defining their up/down/launch keys which the scene will set - previously this wasn't possible, so without a single game controller affecting both, there wasn't a way for the paddles to use different keys.