Accessed none trying to read ActorComponent

Hello.
My AiCharacter blueprint (Actor) has ActorComponent attached, called ‘SenseManager’.
When I want to reference the component from another blueprint, I get ‘accessed none’ error, although both owner instance and component instance seem to be valid (they are created when the level is init, not in the BPs). The only solution I have found so far is to manually delete and then add ‘SenseManager’ again to the owner.
image
image
The branch node in the 2nd pic throws the error.
Hence, I suppose it is a bug?

both owner einstance and component instance seem to be valied (they are created when the level is init, not in the BPs).

Can we see how and when this is done?

1 Like

Hi!
So, as you can see, my ai character bp has several actor components. One of them is the above-mentioned SenseManager, the other is GoapController. I reference SenseManager from GoapController BP. So, all in all, I reference component’s owner’s other component. May it be some sort of ‘bad idea’?
Here is the screen from my GoapController BP. When I enter game, I get ‘Goap controller failed to reference SenseManager’ printed.


As for creation of the ai charcter and SenseManager component, well, I just added aiCharacter to the level in editor. Not sure what else can be said here…

I tried initializing reference to SenseManager from the construction script of the ai character BP, the result is same.

1 Like

I want to add that for some reason SenseManager’s BeginPlay is not fired…

1 Like

Well, it really seems to be unreal bug. What happened:
When I hovered cursor over SenseManager, I saw ‘REINST’ befor the name of the component. Looking up ‘REINST’ told me taht they are some dead copies left by engine, idk…
So i restarted engine, REINST component disappered, I added it again and everything works out fine (for now). If someone form the dev team could check this situation out, it might help future users…

1 Like

This might be UEs way of handling a circular dependency that might be created here. You are hard referencing SenseManager in another component owned by the same actor. If SenseManager also attempts to reference the owner or the owner’s comps in a similar fashion, you’d be instantly crashing (and probably never loading the project again…) in versions below UE4.22. Later on things improved. The circular dependency handling mechanism will surface every now and then.

A bit of a guesswork on my part here since we cannot see the whole picture. And there’s the entire component initialisation process / order sitting on top of everything - something that will not be fixed since it was waived.


Note that the above communication can be gracefully solved with Event Dispatchers, without those components knowing about one another’s existence, and without additional hard refs.

Depending on how complex the classes hierarchy is, you might be better off decoupling it altogether and use an interface instead. This would be recommended if those components could appear in unrelated classes.

1 Like

Thanks for your reply, will look into it