Comments (6)
shouldn't be that much of a problem.
I've implemented it in my fork: soraphis@20ac23e
using C# events. The important part is to ensure that events are unregistered. this could be a problem within the editor, but I think my usage of 'OnAfterDeserialize' should fix this
from unity-atoms.
First of all, the IGameEvent interface is totally unnecessary. It's a left over from when I started the project. Will remove it in a future commit.
Regarding the IGameEventListener, that is a different issue. I have actually tried the same approach as @soraphis is doing in this fork. However, this did hurt performance way too much and it's unfortunately not a viable option (even though it is much more elegant code-wise). Maybe I did something wrong and it's worth a second try? Or maybe there are any other approaches to this problem (can't think of any now though)? I agree with you @mutmedia that it is really awkward when using 2 events of the same type in the same class.
from unity-atoms.
Removed IGameEvent in 16ab226
from unity-atoms.
However, this did hurt performance way too much and it's unfortunately not a viable option
oO thats interesting.
i just looked a bit around and found this article: https://jacksondunstan.com/articles/3043
first: I would not have thought that events would get worse with repeaded use within a short timespan, but I think the conclusion of this article is pretty fitting.
Now that we’ve established which is faster—interfaces—the question becomes: should you bother? Interfaces are definitely more work to set up, harder to read, more error-prone, and more difficult to integrate into your code.
Say your game had a thousand callbacks per frame. That’d be a lot of callbacks, but still 100,000 times less than this article’s test results show. Even in the slowest case—events with multiple callback functions—you’d only be using 0.00749 milliseconds to call all the callbacks.
from unity-atoms.
@soraphis Will read the article when I get time this weekend!
I could definitely try doing the move again and then try it in my current game project. If the performance / framerate is not hurt then great, but if it is noticeable it's unfortunately a no go.
from unity-atoms.
GameEvents are now using C# events since commit d551947 (branch canary). Seems like no noticeable performance hit when implementing it. Not sure why I got such a performance hit last time (probably did something stupid in the implementation).
Thanks for the input everyone! Closing the issue.
from unity-atoms.
Related Issues (20)
- [FEATURE] Upgrading Documentation to Docusaurus 2.x and adding a search plugin
- [BUG] NullReferenceException in HandlePlayModeStateChange HOT 1
- [BUG] AtomValueList keeps runtime modifications HOT 1
- [BUG] AtomValueList not compatible with disabled domain reload HOT 1
- [FEATURE] Improve Inspector legibility
- [BUG] FiniteStateMachine not firing events anymore HOT 2
- A number of issues with AtomLists/AtomCollections HOT 2
- [FEATURE] More public get-properties for fields HOT 2
- [QUESTION] Subpackages documentation HOT 2
- [FEATURE] Variable Resetter shouldn't trigger due to script hot reload
- [FEATURE] Clear "AtomList" and "AtomCollection" OnEnable
- [FEATURE] SceneField for Addressable Scenes
- [BUG] StackTraces allocate garbage when DebugMode = false HOT 1
- [BUG] QuaternionReferenceDrawer Rendering issue HOT 1
- [BUG] CustomStruct Reference Drawer Rendering issue
- [FEATURE] AtomTags - Update TagInstances in Editor
- [FEATURE] Auto drag and drop atom references through inspector without the need to manually switch usage type
- [FEATURE] AtomBaseEventReference to have `Raise` methods inside
- [FEATURE] VFX PropertyBinder HOT 1
- [BUG] Recompiling during play mode resets all variables HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unity-atoms.