Closed JayPavlina closed 5 years ago
As mentioned in chat behind the scenes it is always just overwriting the existing component when you add again, I am not entirely sure if this is correct behaviour or not as you would expect it to add not update/set.
I have added a set of exceptions that are only in debug builds that will throw an exception if you try to add an existing component, but at run time it may not be a problem. Let me know your thoughts on this.
I think including an exception in debug builds but not in release builds is the correct behavior. What preprocessor directive are you using?
I am using #DEBUG
which almost all platforms adhere to, I will mark this as closed but feel free to re-raise if you think there should be other changes. I am happy to discuss other options in more specific issues around adding other notions as atm there is just Add
but maybe there should be Update
or Set
which is what is done under the hood.
I have not tried with
AddComponent<T>()
, but if you useentity.AddComponent(new WhateverComponent())
twice, it will not give an error, but it will only have one of the components.