Skip to main content
10 events
when toggle format what by license comment
Mar 16, 2019 at 21:00 comment added dpaz I am writing something similar, using struct components, and I went with static instances of generic component managers/pools. They handle all logic using generic constraints to avoid boxing, and they keep track each entity's components. EntityIndices[id] gives an index into the pool. I have no need to iterate over the managers/pools themselves for anything but save and load and such, and reduced efficiency is acceptable there. In all other cases, I know which types I need at compile time, allowing me to access the generic static instance. Component enumeration via ref return enumerator.
Oct 30, 2018 at 11:27 answer added Brett timeline score: 0
Oct 29, 2018 at 8:22 answer added HumanNotFound timeline score: 3
Oct 29, 2018 at 1:24 comment added HumanNotFound @ChristianIvicevic Indeed, that certainly made the source code much more difficult to understand when I first went through it! Now that I understand it better I actually kind of like how it's implemented, though as I don't have much experience managing memory myself (sounds fun though) I will likely avoid going that kind of route.
Oct 29, 2018 at 0:54 comment added HumanNotFound @Draco18s You're right, that constraint should be an interface that my structs implement and not accept any old structs.
Oct 28, 2018 at 11:44 comment added Christian Ivicevic With regards to the new ECS implementation in Unity, keep in mind that most of it (especially in conjunction with Jobs and Burst) is designed to be unmanaged under the hood to prevent GC running at all which would be a massive performance loss. This is a reason why you are forced to work with sequential data, NativeArrays and slices that you have manage and dispose yourself.
Oct 28, 2018 at 1:42 comment added Draco18s no longer trusts SE Your problem is likely where T : struct. Structs are...not classes. They're packets of data, like a Vector3 is just 3 floats wrapped up and given a fancy name. Additionally you're trying to say that ANY struct can be a valid component (is a Vector3 a component too?). Its also possible that you need to use the .NET 4.6 experimental version of .NET (in the Unity settings somewhere) in order to have the covariance and contravariance necessary for the kinds of generics you want to use to compile.
Oct 27, 2018 at 22:35 history edited HumanNotFound CC BY-SA 4.0
Re-wrote post/title to be much clearer
Oct 27, 2018 at 9:45 review First posts
Oct 27, 2018 at 14:55
Oct 27, 2018 at 9:43 history asked HumanNotFound CC BY-SA 4.0