* fix: memory allocations due to boxing when creating a StackTraceEntry with disabled DebugMode.
fix: slow repeaded lookups of EditorPrefs for determining DebugMode
* Cleaning up code that was affected by work on #434
- removed dead code
- fixed formatting
Commit-Type: Refactor
* Fix value field height in reference drawer for older unity versions
* Fix property height for quaternions
* Fix property field height for quaternions in variable editor as well
* Fix comment
* 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
---------
Co-authored-by: Adam Ramberg <adam@mambojambostudios.com>
* fix: handling dead references when resetting objects. (#417)
* fix: wrong state checked in AtomEvent reset (#403)
* fix: make AtomValueList compatible with disabled domain reload (#419)
fix: AtomValueList now resets runtime modifications (#418)
* fix: handling dead references when resetting objects for AtomValueList. (#417)
* removed the dead-reference handling (#417)
- this will be addressed in (#421)
compacted the Playmode state change
* Remove Atom types from their _instances lists OnDisable()
* Added disclaimer / comment regarding the solution
---------
Co-authored-by: Adam Ramberg <adam@mambojambostudios.com>
* fix: wrong state checked in AtomEvent reset (#403)
* fix: make AtomValueList compatible with disabled domain reload (#419)
fix: AtomValueList now resets runtime modifications (#418)
* fix: handling dead references when resetting objects for AtomValueList. (#417)
* removed the dead-reference handling (#417)
- this will be addressed in (#421)
compacted the Playmode state change
* [Added] Feature for #67 event name suggestion initial version
* [Refactored] Cleaned naming code to its own class
* [Fixed] c# range is not supported in 2019.4 LTS
* * Simplified logic for suggested name in AtomDrawer
* Simplified CleanPropertyName - first if-block was catched by second block
* Replaced FilterLastIndexOf with typeof(T).Name
---------
Co-authored-by: Thimo de Ram <tdram@esites.local>
Co-authored-by: Adam Ramberg <adam@mambojambostudios.com>
* fix: pasting FullQualifiedName in the generators text field, not picking up the actual type
* fix: replaced TryAdd call to support lower .NET versions
* prevent null reference exceptions in editor when using not-serializable types
* - Draw warning helpbox only once in AtomVariableEditor.cs
- Minor clean up
* Revert unintended removed line
Co-authored-by: Adam Ramberg <adam@mambojambostudios.com>
* removed ondisable method, to fix#349
* Remove _changed and _changedInstantiatedAtRuntime since they are not used anymore
Co-authored-by: Adam Ramberg <adam@mambojambostudios.com>
* fix: #353 while keeping #289 fixed
* Fix height of popup (was covering click area of expanded type's properties)
Co-authored-by: Adam Ramberg <adam@mambojambostudios.com>
* Update CHANGELOG
* Update version in documentation to 4.4.4
* Remove reference to Examples directory
* Update package-lock.json
* Update API documentation
When using an Event Reference Listener with a variable, GetOrCreateEvent() is sometimes called after TriggerInitialEvents(). This commit solves this issue.
* Speedup Atom Generation
This simple change will speed up atom generation via an AtomGenerator. The whole thing will only take 10 seconds instead of +1 minute.
* Update the changelog
* compatibility with dynamic assemblies
* fixing #232
fixed a case where the class namespace might be null
* fixing #232 + corrections, fixing #233
* Fix nested types not being generated correctly
VALUE_TYPE_NAME_NO_PAIR had an incorrect value if the type was nested.
* Reimagine the Generators Type Selector Layout
UNTESTED! I will test if the generator later this week (18/01).
UNCOMMENTED! Same as above.
The new selector will neatly separate namespaces from types, is ordered alphabetically and goes down a new level for every subnamespace. It will now also display nested types as such (so nested type Bar is displayed as Foo+Bar). This means that types of the same name but in different namespaces are now supported.
It will also ignore any abstract or generic types as Atoms can only generate solid types (...I think?)
If you want to check it out, I recommend looking at how NamespaceLevel works. It splits types up into types that have reached their namespace level and types that can still go deeper, in which case they are rooted as part of the NamespaceLevel. From there, it can handle adding dropdown items and finding a selected Type.
* Enable all GenerationOptions by default
Or on a Reset of the SO
* Ensure instantiated generator has unique assetpath
This can otherwise lead to weird behaviour if a new asset is created at the path of an existing asset
* Use variables for SerializedProperties
* Make objectfields to generated scripts readonly
These should not be edited which may lead to errors.
* Add comments
* Use hash to find which type belongs to which DropdownItem
* Use level to distinquish between namespace levels
Using TrimStart was also trimming off characters after dots (.) if appropriate.
* Safety measure
Ensure serializedObject.Update is called in the beginning of OnInspectorGUI.
* Fix size of Dropdown
It will now neatly cover all the generator options. This doesn't really matter at all, I just think it looks neat, plus it ensures there is always enough view to not have trouble selecting a type.
* Use CompilationPipeline to get assemblies
Pros: It only collects Unity Assemblies that are not Editor Only. This ensures that every type will 100% be compatible in builds.
Cons: It doesn't find any assemblies outside of Unity, for example the System assembly.
Personally I like this way better since it ensures support even for cross platform development. Imagine someone generating a type you can only find in Windows, then trying to build for Mac. We can still populate the base package with the base values from systems and people will still be able to create Atoms for unsupported values, just not using the generator.
Alternatively we could create an "unsafe" toggle.
* Use CompilationPipeline to get assemblies
Pros: It only collects Unity Assemblies that are not Editor Only. This ensures that every type will 100% be compatible in builds.
Cons: It doesn't find any assemblies outside of Unity, for example the System assembly.
Personally I like this way better since it ensures support even for cross platform development. Imagine someone generating a type you can only find in Windows, then trying to build for Mac. We can still populate the base package with the base values from systems and people will still be able to create Atoms for unsupported values, just not using the generator.
Alternatively we could create an "unsafe" toggle.
* Add Safe Search toggle to AtomGenerator
Previously, the AtomGenerator was only able to generate types that were Unity compatible and either Serializable or ScriptableObjects.
The first change is that it now also searches for Objects to account for prefabs.
The second change is a toggle next to the generator to differentiate between searching for Unity compatible types and searching for all types (denoted as "unsafe types"). This does what it promises: it gets all the (dynamic) assemblies it can find, retrieves all exported types, and makes no distinction between serializable or nonserializable. This returns the functionality to generate for example strings and ints with the generator.
* Add Quality of Life improvements to the Editor
Co-authored-by: Casey Hofland <hofland.casey@gmail.com>
* Add auto focus on textfield
* Prevent PrefixLabel showing up in AtomReferences
* Add Keyboard shortcuts to confirm/deny create
* Add Focused Control Check