mirror of
https://github.com/unity-atoms/unity-atoms.git
synced 2025-01-21 23:58:49 -05:00
f2b9186eef
* Added the ability to drag and drop any atom reference to a `AtomReference` without the need to manually select the type through the 3 dot button on inspector - I also refactored the `AtomBaseReferenceDrawer` script so that it's easier to read/maintain. - The class `BaseAtomInstancer` is needed to be able to auto reference instancers. Because when we drag a `GameObject` we need to get it's `AtomInstancer` component to determine the reference type. Also, the class represents something similiar to `BaseAtom` for `ScriptableObjects` but for `MonoBehaviors`, so it makes sense to have it. * Addressed some of the key points @soraphis made and fixed the issues I mentioned on the #442 pull - Solved the probelms that arise when a `GameObject` has multiple different instancers in it (mentioned in the #442 pull) - Removed `UsageIndex` class as it is not needed * Fixed file name not matching the class name * Addressed @soraphis issue of `GuiData` not being a struct, so I changed it and modified the `AtomBaseReferenceDrawer` to handle it as a struct * Fixed `GuiData` isn't updated even though `position` and `label` parameters of the `OnGUI` are. * Reversed the for loops order because the order of the components inside the `GameObject` are more important than the order of the "usages" so it fixes that problem - Also cleaned the code a bit * Missed a line that could be simplified - Made `Set/GetUsageIndex` into static because we can * Fixed issue mentioned in #442 > "you only get the first component, when dragging in a game object, so there could be the case where selecting the type manually and dragging into it will swap the field" The issue is when there are multiple instancer components in a single `GameObject` then when you drag said `GameObject` then the atom reference will switch to the first instancer (via usage index) no matter the intent of the user. However, the intent of the user could be to pick the 2nd or 3rd reference, so he could manually select the usage type using the 3 dots button, but it won't work if he decides to drag and drop a `GameObject` that has multiple instancers that the reference could switch to automatically, which will always be the first instancer of the dragged `GameObject`, which bascially makes the experience frustrating to that particular scenario. Now, you can guess that the issue is hyper specific just because of how hard it is to me to explain it in text, so don't worry if you didn't get it on the first read. If you would like me to showcase it, I will gladly share a video example of what I mean. * Fixed index out of range exception (I forgot that I set the usage index at the end of this method and it could be -1 because of this line) * Redone the previous push because it was incorrect * Response to @AdamRamberg to try to make the code section clearer by refactoring it * * Minor cosmetic changes * Replace switch expression to be backwards compatible (for example to be able to run the unity-atoms-example project) * Always remove the last greater than symbol in GetPropertyTypeName to take into account generic types * Added comment to IAtomInstancer * Removed `GuiData` * testing being able to merge * Removed `GuiData` in the new merged push * Removed `GuiData` class once again * Integrated the #447 fix - Also the variable `initialPosition` was missing so I added it back - Swapped the ordering of the `position` and `property` inside of the methods to match the ordering of the `OnGUI` method (I think it just makes more sense visually to order it this way) * Revert removal of compiler flags when setting valueFieldHeight --------- Co-authored-by: Adam Ramberg <adam@mambojambostudios.com> |
||
---|---|---|
.. | ||
BaseAtoms | ||
Core | ||
FSM | ||
InputSystem | ||
Mobile | ||
MonoHooks | ||
SceneMgmt | ||
Tags | ||
UI | ||
BaseAtoms.meta | ||
Core.meta | ||
FSM.meta | ||
InputSystem.meta | ||
Mobile.meta | ||
MonoHooks.meta | ||
SceneMgmt.meta | ||
Tags.meta | ||
UI.meta |