jacobdufault / fullinspector

Full Inspector supercharges Unity's inspector
MIT License
111 stars 27 forks source link

Multi-scene support for storage systems #201

Open SugoiDev opened 7 years ago

SugoiDev commented 7 years ago

This is a initial working version of a multi-scene storage system. FI's backup and storage systems are broken with multi-scene. This PR brings initial support for multi-scene setups.

I would appreciate some code review and ideas for dealing with Unity's cross-scene weirdness, if anyone has know-how in that area.

Warning

Overview of changes

Most other changes are just related to API change (like using instance IDs in certain places, since the actual references would be dead when exiting playmode or changing serialization type). Also adding a null-guard for the only usage of Read method, that can now return a default(T).

What isn't good yet

Note: Unity will show warnings when we move a FI object from a scene to another. This is because we're storing a reference to the object in the scene storage(s), and Unity forbids cross-scene references (will show a "scene mismatch" message on the object's field, as well as warnings in the console).

jacobdufault commented 7 years ago

How has this been working out for you? If you have a more recent version feel free to repush and ping and I'll take a deeper look at the changes.

SugoiDev commented 7 years ago

I've been using it ever since without issues in a multi-scene heavy setup. I don't do a love of cross-scene objects moving, but that was the only thing with some issues still (unity warnings for cross-scene refs).

This cross-scene reference madness is probably because Unity lacks actual persistent object IDs in its pseudo-ECS.

SugoiDev commented 7 years ago

I might have some extra changes here, so give me a few days before you review/merge.

SugoiDev commented 7 years ago

Alright. I've added a few missing files from my current project and fixed the unicode characters in the backup context menus.