x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Edit default 'Variable Name' of Actor Component

Hi,

Is it possible to edit the default variable name when an actor component is created in blueprint?

I'm aware of the DisplayName specifier in the UCLASS macro, but this only changes the name in the Add Component drop-down. The variable name is always the class name in code.

The 'Variable Name' variable is defined in BlueprintDetailsCustomization, so I don't know how to access that from the object itself.

I have also tried using the Rename() function but that doesn't change the blueprint's variable name.

Product Version: UE 4.20
Tags:
more ▼

asked Oct 30 '18 at 12:08 PM in C++ Programming

avatar image

Epok
70 6 11 66

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi Epok,

I am sorry, but no it is not possible to change the default variable name for newly added components. This is because the sequence of events that occurs after selecting a new component class essentially calls NewObject by passing in NAME_None for the object's name. Doing so internally generates a new name for the component based off of its class name.

more ▼

answered Oct 30 '18 at 04:39 PM

DarkwindRichard (suspended)
avatar image Epok Oct 30 '18 at 04:48 PM

Thanks for the info!

Is it not possible to change that name after creation either then? Say in OnComponentCreated?

avatar image DarkwindRichard Oct 30 '18 at 05:16 PM

Hi Epok,

I do not believe it is possible to change the name there, either. I wrote a small test that calls Rename in OnComponentCreated, and the created component still did not have the new name. Doing so also removed my ability to manually set the new component's name. As long as you are okay with that, you may be able to successfully change the name by setting a timer to delay the call to Rename but that all seems like too much of a workaround to have a custom operation that changes the names of components.

Is there a reason you cannot just change the name of the component class itself?

avatar image Epok Oct 30 '18 at 05:22 PM

Ah ok, not to worry then.

I am writing a plugin for the marketplace, and to avoid any class name clashes with other plugins, I have put a prefix in front of every class - it looks a bit ugly in the editor is all!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question