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"

Construct Object From Class vs Spawn Actor?

I've been wondering what the exact differences in behavior between the two are.

I know that spawning an actor technically creates an object in the world, and that constructing an object does not. What I'm curious about is garbage collection. When spawning an actor I can remove it using the Destroy Actor node, how is that handled for objects? Do they automatically get purged from memory once there are no more references or is there something I'm missing?

Also, spawning an actor allows me to pass certain variables (apart from location/rotation etc.) like you would pass variables in C++ when instantiating an object (-> constructor). I've not been able to replicate that when constructing objects from a class, so I was forced to make a separate "construction" method within the class. Is there a way to avoid that? I.e. allowing for proper construction arguments?

I've not been able to find anything regarding those issues, but if I've missed something, I'm sorry for double-asking.

Thank you for your help!

Product Version: UE 4.16
Tags:
more ▼

asked Jul 05 '17 at 01:15 PM in Blueprint Scripting

avatar image

xNaXDy
16 2 4 9

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

1 answer: sort voted first

Yes UObject gets Garbage Collected if not refferenced anymore. As far as passing Arguments thats a Complicated story you better of creating a simple Init Method with the Parameters you want. If you want to have the Inputs avaivable in Blueprints add

 UPROPERTY( ... , Meta = (ExposeOnSpawn = true))

to any variable. They will show up in the Construct Object node automaticly.

more ▼

answered Jul 06 '17 at 12:13 AM

avatar image

Nachtmahr
7k 143 28 172

(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