Hi,
I’m working on a hitbox editor for my game - see my comment here for more details. As a summary for this post, here’s the context:
- A
Hitis a game object with a collider, and updates are applied to applicable game objects that come into contact with the collider (e.g. if a hitbox collides with a character, the character takes damage, has their velocity updated, etc.) - Hitboxes are generated by a
Cast, which statically defines, on a per-frame basis while it is active, whatHitprefabs to instantiate and where to place them in space
As a matter of application, here’s what I’m trying to do with them:
- View
- Stop real-time physics updating for the game, and allow for walking through the game phyics on a frame-by-frame basis
- Instantiate a
Castand theHits contained within; step through the frames to enable/disable theHits
- Modify
- Modify the
transformof a selectedHitfor the given active frame - Propagate changes of an active
Hitto the prefab that it comes from
- Modify the
The above functionalities are currently in place, so here’s my issue: As far as I know, I can only step through the frame-by-frame logic of my Cast by running the game, so I play the game with the considerations mentioned above. I can do everything that I want to do in the running Game view except for modifying the GameObject Transforms, so I have to switch between tabs to Scene. Then , after changing the transform, I can only step through frames again, run the command to save my changes, etc. in the Game view.
This might be a bit of an XY problem, so if the above is my Y, here’s my X: For the sake of ease of editing, I’d like to do both from the same view.
In order to meet this condition, here are the gaps in my Editor’s capabilities that I’d need to satisfy:
- For Scene view: I’d need to be able to collect user input that I could then apply to my running game’s state. I don’t really understand how Unity processes the Game and Scene views differently, so I don’t know how feasible this is.
- For Game view: I’d need to add functionality to select game objects and modify their transforms from within the running game. Using the implementation refrenced in this video, I actually started with this route, but I think it’ll take me a lot more work to achieve that, because I’d need to add the previously mentioned functionality as well as camera controls, which effectively reinvents what’s already available to me in the Scene view.
In summary, I think the answer to my X problem involves fleshing out the mentioned functionalities in the editor views. The Y problem I initially mentioned would solve my X problem by enabling me to build the functionality I could use for the Scene view. If that’s impossible/infeasible, then I’d have to do all of the work involved for the Game view functionality.
