#Companion Component not compatible with Runtime hybrid component when inspect it.

1 messages · Page 1 of 1 (latest)

random scroll
#

after use EntityManager.AddComponentObject to add Custom monobehaviour to my entity, the next frame all these component set to null (gameobject&managed component still exist, MangedAPI.HasComponent return true), this **only ** happens when **any ** object is inspecting

both entities 1.0.14, 1.0.11 has this issue.

twilit wyvern
#

or in runtime?

#

oh nvm

#

I read it wrong

#

Just having component in archetype != it has a non null value

#

just like normal struct component can be default managed component can be null

random scroll
#

runtime, after some test, i found this only happens when i inspect any thing in the subscene. (no matter when)

#

everything works fine if i select nothing in inspector.

twilit wyvern
#

maybe you are adding destroyed game object?

random scroll
#

nope, as i said , this only happens when inspect anything, maybe it triggers some baking logic then dirty the result? much like a bug in entites managed store...

twilit wyvern
#

what happens even?

#

Can you show screenshot/error-stack?

random scroll
#

these are managed monobehaviour (can be inspect on first frame), then it became:

twilit wyvern
#

this looks like they are just fields in some managed component or am I mistaken?

random scroll
#

no, it is monobehavior that added by EntityManager.AddComponentObject

twilit wyvern
#

then it means they are null

#

you need to check for null value, not for component existance

random scroll
#

i doubt it is my code issue, because it only happens when using inspector.

#

and no matter when i use/what i select the inspector, after that, the components become invalid.

twilit wyvern
#

but are they truly invalid? can you check in code?

random scroll
#

do you mean after ManagedAPI.GetComponent, i still need to check null?

#

but even with that, how can i ensure i can add&get the component i want?

twilit wyvern
twilit wyvern
#

it can be null

#

that's about it

#

same as entity reference. It can be Entity.Null

random scroll
#

i know, but i never remove them, and null-check won't make the code right...

twilit wyvern
#

it's not about removing

#

it's only about setting

#

because you potentially just set it to null

random scroll
#

how's that even happen. the only thing i do is select any gameobject in the Hierachy.

twilit wyvern
#

🤷‍♂️

#

I just tell you to check