Can you disable actors?

Is there a way to disable an actor so they (and their children) do not display, tick/process, collide without explicitly going through and setting those states manually? Essentially ‘destroy’ them with the ability to bring them back.

1 Like

Hey Heisenburger,

You can set an Actor to be Hidden in game via Blueprints. Hidden Actors are effectively removed from the level in terms of collision, visibility, physics interactions or tick events, etc. You can then unhide it when whatever condition you want is met.

Hope that helps!

Ben Halliday

1 Like

Thanks Ben Halliday,
This answers a question I had posted earlier.

See Actor destroys automatically after setting hidden and disabling collision - Editor Scripting - Unreal Engine Forums.

When I tried just setting the actor hidden in game I couldn’t ever make it visible. When I tried setting visibility of the mesh, it worked better.

Hi,

I don’t know why, but it doesn’t seems to work for me :frowning:

When I set “Hidden In Game” to true, it just make my actor not visible, but it still have collision, it’s still focuses by AI, and if I don’t unpossess it from my controller, I can still run, attack and so on.

Do you have an idea of what is going on ?

Thanks !

I don’t really know what setting hidden in game is really supposed to do so I can’t help directly. But you can disable collision with a separate blueprint function.

As for AI, that’s something I hadn’t thought of. You could set a variable or interface function or something so that the AI can check if you are suppossed to be hidden and ignore you.

Hope that helps.

Good luck,
-X

Yeah, ok, I’ll do it like that.
Thank you :slight_smile:

Hey all,

Some clarification:

I’m not certain whether Hidden was doing more previously than it does now, but to properly make an Actor in the level “disabled,” you need to do three major things: Set Hidden in Game, Set Enable Collision, and Set Actor Tick Enabled. Hidden in Game and Visible refer to two different things. Visible only means that you can see it in the Viewport during editing. Hidden in Game only refers to visibility during the game. So you can have an Actor that is Visible while editing and Hidden during gameplay. The default is Visible while editing and NOT Hidden in Game for most Actors.

To effectively hide an Actor and remove its collision, you need to explicitly declare both, either with the Construction Script or during Play. In 4.7, you can also use a new node, Set Actor (or Component) Tick Enabled, to make sure nothing else is running.

Hope that helps!

Any chance someone could take a few minutes to give us an actor native function to Set Hidden In Game On/Off, Set Collision On/Off and Set Tick On/Off? Would be pretty convenient for object pools and the like and wouldn’t take long to do. May just do it myself before too long.

Hi DesertEagle_PWN,

It’s unlikely the devs will implement a combo function like that, but it should be easy enough to create one in Blueprints or code in a Blueprint Library and use it across your project. If you decide to develop one and create a pull request, the devs can take a look a decide from there.

Here’s one I made:

2 Likes

This simply isn’t true. Set Actor Hidden in Game just prevents it from rendering, but it still has collision and runs actor scripts, which is why you need the solution in the accepted answer.

Ben is incorrect. Everyone should take the answer which was accepted. Here is a pic proving “Hidden in Game” only handles rendering (the stairs are hidden):

202152-__capture.png

This is not the right answer. Please fix!

An old thread I know, but google spat it out in answer to my question and it worked perfectly.
I am using this triple: SetActorEnabled>>SetActorEnableCollision>>SetActorHiddenInGame
to swap my player between different character classes and back again (I have a separate character for dialog functions with NPCs)
Engine Version 4.23