✅ Code improvement
Hey guys, just wondering if there's a better way to do the function i did.
14 Replies
if you want the code in some more readable space: https://paste.mod.gg/bgbysrsbzqco/0
BlazeBin - bgbysrsbzqco
A tool for sharing your source code with the world!
could certainly be improved. Generally, it's a good idea to reduce nesting and "fail fast", so rather than
I would write
ok
could also be made more performant by using
Instead of sorting the whole collection just get the item at random index
Besides that, it seems fine
I'm not familiar with Unity enough to tell whether stuff like using the
lock
instead of some concurrent collection is a good choicenot unity, wpf
Ah, huh, that
Random
threw me off
Unity has static methods on Random
class, while in C# you need an instance, and static methods are on Random.Shared
insteadAh lol
wanna see the whole code to see where i could improve
?
You could post a Github link to #code-review
id have to post it on gh
It's a good idea to keep your code there anyway
i was going to do that, just later
ok, posting it on #code-review