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"

Createing a Uobject in a seperate thread

I need to create several large UTexture2D objects at runtime and fill the mipdata. but doing so freezes the game until the have all been created. And I know that Uobjects currently are not thread safe. Is there anyway safe way to do this in a seperate thread?

Product Version: Not Selected
Tags:
more ▼

asked Oct 21 '14 at 04:04 PM in C++ Programming

avatar image

Opamp77
264 21 17 139

avatar image gmpreussner STAFF Oct 21 '14 at 04:05 PM

I don't think there is a safe way to do this right now. Core Team is currently working on thread-safe UObject creation and destruction, however. I will assign someone who may have more details on this matter (I am desperately waiting for it as well :) )

avatar image Rama Oct 21 '14 at 07:41 PM

Please do me a favor Gerke and let me know when we have multi-threading + UObject subsystem, that will be a game changing event!

:)

Rama

avatar image Opamp77 Nov 25 '14 at 07:59 PM

Is there any news on this yet? I noticed that there was some mention of improvements to Uobjects for 4.6 But im not sure if thats in relation to multi-threading.

avatar image idbrii Oct 05 '15 at 06:43 PM

According to this thread it's available, but you still need to be careful about how you interact with them. (Maybe also that your target object won't be garbage collected during your access.) I can't find any more information than that.

avatar image iniside Feb 23 '17 at 01:41 PM

Hey any updated on it ? I tried spawning UObject/UActorComponent from different thread. While it somewhat worked it was hardly safe as GC just cloudn't handle it. Adding hardreferences to rootset somewhat helped, there were still occsional crashes (unrelated to my code, as my test object didn't do anything special).

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

2 answers: sort voted first

Hey hey

I managed to solve this issue pretty simply. and now can create threads in blueprints and in them create Uobjects So here is a hint.

create a structure for jobs to enqueue on the game thread create a : TQueue jobArray; have a function that just Enqueue to this queue. then use it in your thread to enqueue jobs in the game thread. Now in the Tick function have something similar to the following

 FJobEnqueueStruct* currentJob=nullptr;
 if( JobQueue.Dequeue(currentJob) )
 {
   // call a function or a blueprint implementable Ufunction
 }

Tqueue is thread safe so there is no concern about it. and this way you can even design you nodes that to be run on the game thread via blueprints

more ▼

answered Dec 05 '16 at 09:59 AM

avatar image

plangton
367 17 20 31

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

I have solve this issue while writing my own custom Kinect plugin. create your textures outside of the thread code and in the class which you handle the thread or in the actual thread code just keep a pointer to the texture ( UTexture2D* texture ) this way you can simply modify the texture in your code.

more ▼

answered Dec 13 '16 at 11:04 AM

avatar image

plangton
367 17 20 31

(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