2023-12-25

Project Raygine #6

I had to fix a lot of little bugs all over the place and I finally started replacing the old scene editing. There's no rendering yet, but reordering scene nodes and adding/removing them works. Adding components works too, though there's no real functionality to them yet.

Raygine scene editing window

There are also a few interesting tidbits that are now possible since the scene format is entirely working like a scriptable object in Unity; There's a flag to "expose" an entity. An asset file is a collection of objects, but per default, only the first one is displayed in the inspector when the asset is selected. It is, so to speak, the main object. But if you set the "expose" flag on an object, it will be displayed in the inspector as well. I need the expose mechanic for assets that are designed to have multiple objects that can be edited through the inspector and adding a toggle to each entity is easy to do. I am thinking like two steps forward already, but I think this is interesting for making prefabs: Exposed objects can be referred to from other assets.

So my thinking goes, that an entity could be flagged as "exposed" and in return it could be dropped into other scenes as a prefab node. I think I will deviate from Unity's implementation a bit: I think I would handle this via a "prefab" component. That component will take care about the instancing and tracking override values. It's still a little unclear to me how to do that in detail, but I have the feeling the direction is right.

On the screenshot, there's a little detail that can be overlooked but that sheds light on how the system works:

Raygine entity object in the inspector with a few buttons

The entity here shows a few buttons to add new children / components or to remove the entity. This functionality is not provided by the inspector / scene editor but is provided by the type's gui script. It's a system to customize the rendering of the objects in the inspector.

Thinking about it, I think the hierarchy view should work in a similar way; if I have a prefab component, it would be good if the hierarchy mirrored the prefab's hierarchy, while editing is tunneled through the prefab component to capture override values.

Roadmap

This roadmap is very rough and likely to change much. It's more like a list of things I want to do in the near future.

🍪