Change blueprint's instance ChildActor's component.

I have a setup like this:

  • MainActor BP that has ChildActor component that’s using SubActor BP as it’s “Child Actor Class”
  • SubActor BP has just StaticMesh component that’s using some mesh and matterial override (let’s say Material A).

I’ve noticed that MainActor in my level has different material for some reason, let’s say Material B (no idea how it occurred) - so instance of this actor on the level has different value for the MainActor.ChildActor.SubActor.StaticMesh.OverrideMaterial. Any ideas how I can change it? Is it possible to do from UI without creating some utility blueprint?

When I try to select SubActor in the outliner it appears to be unselectable (demo is below). If there was a way to see it’s details in UI, I assume, it would be possible to change the override material.



1 Like

You should be able to say

or change it in the main actor child actor properties

image

But it doesn’t work, eh? :smiley:

Child actors ( in blueprints ) are a pain in the neck, even when they are working. Investigating…

Ok, a slightly less painful way of using child actors, is with interfaces. It turns out, you can set the material with an interface, even from construction

image

childactorcolor

EDIT: Later I realized you have to do this

1 Like

Couldn’t reproduce this :frowning:

The only difference I have is missing “cast Child actor from Target to Child Actor” node, what’s that? It seems to connect without it and it this node doesn’t appear for me.

1 Like

Pull from ‘child actor’ and search for ‘get child actor’

1 Like

it worked, thank you!

Any ideas if it’s possible to do it somehow from UI for users that are not familar with blueprints?

And why the first setup with cast doesn’t work? That seems odd.

1 Like

Now that you mention it ( and I think about it again ), with the cast, you also have to use ‘get child actor’, then cast.

Like I say, not friendly… :slight_smile:

There’s no reason why you can’t do this from a widget utility blueprint.

I just checked it, and fixed my first answer, it’s

What a bit of work :smiley:

1 Like

Also noticed a weird behaviour - I thought if I set material that way it then this instance of MainActor.ChildActor.SubActor would kind of remember but it seems to be resetting on every construction script tick.

E.g. setup below - it’s writing MainActor variable to the ChildActor.Subactor material. But if I stop doing this every construction script tick, ChildActor.SubActor material will reset to the default. :thinking::thinking: Kind of unexpected - I thought this material value is stored somewhere as this instance value in level but turned out it’s always falling back to default if not persistently set to something else.

Construction can run hundreds of times when you just drag the actor across the map.

I understand, just was expecting Subactor’s attribute to act as main actor’s attribute - stored in the level instead of resetting to default every tick.

1 Like

It’s not on tick, it’s just when the script runs again.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.