Is there a way for "Editor only" Actors

Hello,

I was wondering if there is currently a way for me to have “editor only” actors.
Basically I want to be able to place some custom actors and then from them bake some custom data.
I know how to do the "“baking my own custom data” part but I can;t see a way to have “TOOL ONLY” actors and objects.

If there is nothing of the like maybe there is a way I can add a UCLASS property parameter to my class definition that will exclude the actor from being cooked ?

Hey -

Just to make sure I understand your question, you are looking for a way to have the actor usable in the editor but not show up in game, is that correct? If you need to see the actor when working with it in the editor but not see it when the game is ran you can use the “Set Visibility” option to hide the mesh during gameplay. If it’s meant just for data storage you can not give it any mesh at all. Then any blueprint you create with the class will be able to be placed in the level and used to hold data/make calls but it won’t be rendered since there is nothing to render. I hope this information helps and best of luck in your project.

Cheers

I want that the actor is not being cooked into final game data at all. i.e. if i place 100000 of these actors i don’t want them to be in the final game.

i.e. something like

UCLASS(ToolOnly)
class AMyDebugEditorActor : public AActor
{
    UCLAS_BODY_DECLARATION()
public:

      void SomeDebugMethods();

};

You should be able to use a #if WITH_EDITOR wrapper. It would look like this:

#if WITH_EDITOR

//editor only code -- doesn't appear in final game

#endif

Anything inside the wrapper can be called while working in the editor but should be ignored in the finalized game.

okay but how does that work for actors saved in a level ? Will they just not be serialized ? will it remove “unknown” data ?

Hey -

I’m unsure of what exactly you’re trying to accomplish. If you are trying to include certain code when working/playing the game in the editor then the WITH_EDITOR wrapper will do this for you. If you are trying to include certain assets while in the editor that you don’t want in the final release, those assets would have to be explicitly removed before packaging. However data from those assets would be removed as well unless saved elsewhere (such as a separate file that is explicitly included in the packaged version).

It would be possible to create an actor/asset (such as a blueprint) that isn’t actually placed anywhere. You can use the asset within the editor but as long as all references to it are removed before packaging then it would not be accessible in the final game.

If you have any other questions please describe how you are trying to use the actors you’re referring to. Having a better understanding of what you’re trying to do will help determine if it is possible and if so, what options are available.

Cheers

Hi ,
thanks for you answer,

Here is what I am trying to do :

I have a rather large “AI Network” , it consists of nodes and links which are placed and connected together via the editor.nodes consist of positions and a list of links. A link contains a pointer to nodeA and nodeB. (there is other data ofc but lets keep it simple).

I can place the nodes in the world (actors).
Let’s assume there is a very very large quantity of these nodes so the memory/streaming impact is non trivial.

I want to bake this data into a very lightweight format which I can on my UE4 client and I can it on my non-UE server.

What I usually do when doing this kind of system is I create an “editor” version of my data and then I bake my data to a “game version” . in this case my “Game version” is only server side. I dont want any of it on the client.

This is why I want my placed actors to be present only in tool and not in game.

I hope this explanation clears things up.

Keep in mind I am able to modify the engine source code so on a previous UE3 project we hooked into the cooking and removed certain things from being baked (or added stuff on baking) but that was UE3, I am hoping that with UE4 there is already a “good way” of doing this :slight_smile:

It sounds like what you are trying to accomplish is a means of AI control and navigation. Rather than using a node system (which is how it was done in UDK) you can instead use a Navigation Mesh Bounds Volume. This NavMesh can be used to simplify how to determine the parts of the level bots and AI can move to and interact with. Below is a link to the documentation page for NavMeshs as well as a user made video tutorial on creating and setting up a NavMesh

Docs : https://docs.unrealengine.com/latest/INT/Engine/AI/BehaviorTrees/QuickStart/2/index.html

User Video: Unreal Engine 4 AI Behavior Tree & NavMesh - Part 1/5 - YouTube

Let me know if this helps or if you have any other questions.

Cheers

I appreciate the links but I think this isn’t really part of my question :slight_smile:

You asked me what i was trying to accomplish and there was just the answer as to why I need to have “Tool only data” .

Hey -

I apologize for the delayed response. You could try using the #if WITH_EDITOR wrapper in an Actor class. If you write the entire class inside the wrapper then any use of that actor will only be present while working in the editor, however you would still need to save a copy of the actor’s information elsewhere if you want it to exist when not in editor. Alternatively, rather than have a countless number of actors in the scene each holding the data required (lets refer to this as tempActor), you could try creating a “data” actor. The data actor can then be used when you add an instance of tempActor to the scene. The tempActor will calculate the information it would need, pass that information to the data actor and then delete itself. In this way the data actor acts as a spreadsheet of all the information each tempActor would hold.

Hello! Sorry for reviving this old post, but I am interested in this feature as well. Is it possible by now? What I need is exactly as it is described there. To provide further explanation:

I am procedurally creating e.g. buildings. I use a blueprint for this with widgets and set their variables through the details panel. The blueprint uses other blueprints as well and constructs them dynamically at editor-time. Now, when I bake my project I want to completely remove this building blueprint and all its sub-blueprints from the world. I just dont want it to be included. Yes, this may sound weird, but I am actually going to have another tool which will scan through my world and replace certain blueprints in a way, that I will only have the static meshes left in the editor. Those will be placed statically (as opposed to the dynamic construction). The tool will also set the blueprint that was used to invisible, so that it will not interfere with further development. But I do not want to remove that blueprint entirely, because I want to be able to undo the step above for the case that I e.g. am not contend with the way the building looks. In that case I could simply remove the static representation of the blueprint and turn back to my constructing blueprint, were I tweak the building anew and then turn it static again once Im finished.

The reason I want to do this is simply for performance. I do not need to dynamically construct those objects at runtime, so it is fine if the construction happens only at editor-time.

From what said it should be possible to just wrap the code that is editor only into a #if WITH_EDITOR wrapper and the entire class would disappear from the build when cooked. I am not sure what happens to the data though if it gets stripped as well since it is now unknown data (or unknown actor in my specific case). I still have to test this but i had to put it on hold to work on some other stuff. Will try get back to it and report back at some point. Please do let me know if you find out aby useful information too. :slight_smile:

I sure will do :slight_smile: I kind of doubt that wrapping the blueprint into #if WITH_EDITOR will be even useful… Also, how do I wrap a non-c++ blueprint with it? I mean, my tools are whole blueprints doing handy work, they are not simply data :confused:

I think this feature is missing and it should be considered whether they should add it in a future update.

I think I might have found something. Take a look at
Project Settings > Packaging > Directories to never cook

I think this might do the trick, but I have no way to test it currently

Edit: never mind, this throws an error when packaging

Btw, I tested this:

I wrote a C++ actor and wrapped the class inside “if WITH_EDITOR” and created a blueprint from it. I placed an instance of the blueprint in the level and had it print a string at BeginPlay. But when packaging the linker throws an error. It tries to link the methods and classes that are within the wrapped WITH_EDITOR and complains that there are no such classes and methods declared anywhere. This happens in MyProject.generated.h (if MyProject is my project name)

I suspected this might happen. I think we really need an attribute on the UCLASS macro that tells the unrealbuild tool that a class needs to be stripped from the shipping game build.

I also fear that this thread is not going to get any further attention… In that case I might try to repost this question sometime after I have tried to change the source code of UE to implement this change. But I think it would be much quicker if this was implemented by Epic, since it does not sound too difficult…

It would be preferable if Epic would provide this but yes if you manage to get this working please post back, I am still working on other stuff but once I get back to this I will keep the thread updated.

Possibly, the best solution is to put your editor-only actors in a sublevel (one that’s streamed in and exists in the same space as your main level). Then, when packaging, you’d have to exclude that level (either remove it from disk for packagin or only load it on WITH_EDITOR).

I’m not sure two levels is a great workflow. Using Layers would be better, but I don’t know how you’d turn it off for packaging (aside from deleting that layer).

I think the Epic approach is to find an alternative to many actors. The navmesh bounds is a single large actor that aggregates the navigable area within the volume. If you want designers to place your actors and adjust properties on them, then you might have to do a lot of custom work (so actors is a much easier approach).

I actually discovered something today. Components have a boolean “Is Editor Only” property. If it is set to true, it will be excluded from cooked builds. This does exactly what we want (at least for components).

Can we see the same for actors as well?

1 Like