Unity-Technologies / EditorXR

Author XR in XR
Other
930 stars 167 forks source link

Drag-to-assign for Assets #456

Closed stella3d closed 6 years ago

stella3d commented 6 years ago

Support assigning a variety of assets to their relevant components on objects in the scene.
Should enable a few more things to be done in EditorXR, particularly because of being able to add any MonoBehaviour.

All of these assets are assigned by dragging them out of the project view, direct selecting an object with the hand holding the preview, and then releasing the trigger.

Asset assignment types this supports:

1) Add any MonoBehaviour to an object. 2) Assign an AudioClip to an object. If no AudioSource is present on the object, one is added 3) Assign a Material to an object's Renderer. 4) Assign a Shader to an instance of the 1st Material on an object's Renderer 5) Assign a PhysicMaterial to an object's Collider. 6) Assign a Font to a TextMesh on an object.

stella3d commented 6 years ago

on the idea of the fallback / catch-all for assigning: I think it's a good idea, but i'd like to do it another PR.

stella3d commented 6 years ago

@AndrewTHEManeri i have some idea of how we could implement generic 1:1 assignments ("custom drop paths") without too much trouble - if you think it's worth having for this, i'll tackle it before merge.

mtschoen-unity commented 6 years ago

Manual merge successful. Performing Github merge.

Note: My final commit (4f1d6f5) cleans up an oversight on #460. I was testing whether it would work to update the inspector on every hierarchy change, but this is not viable as too many other actions (like tooltips) cause hierarchy updates. With this functionality available, I added a call to UpdateInspectors on dropping references to make use of that feature.