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"

Spawn blueprint based on name

Hey all,

I am using a custom server and really need a way to spawn classes/objects dynamically based on information from the server. I am fine with doing this in either C++ or Blueprint scripting, I just need a good way to do it. I know in C++ you can reference Blueprint classes directly but this is frowned upon. Is there any other way to do something like this?

Thanks

Product Version: UE 4.6
Tags:
more ▼

asked Sep 07 '15 at 02:37 AM in Blueprint Scripting

avatar image

Lojo
90 2 2 9

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

2 answers: sort voted first

If you want something more robust than just sending the string name across the network and spawning it that way, you can make a data table with ids you'd store on the DB that has references to the corresponding blueprints, which you can store int he data table as actual blueprint references and spawn them that way. Otherwise you can just send the string of the blueprint you want to spawn and spawn it.

You're probably making a bigger deal of the problem than it actually is, and that's ok. Don't be afraid of getting it working just sending the string of the blueprint reference and making it better later.

more ▼

answered Sep 07 '15 at 03:08 AM

avatar image

mrooney
703 40 31 123

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

Build your client-server solution in a way to make use of FStringAssetReference

Server can handle these as strings.

On the client side, create AssetLoader as singleton or somewhere in your GameInstance (because there is only one per running game).

When client receives this string, get AssetLoader to load relevant asset. After that you can use it like any other asset. (eg you can spawn it as an actor in required location)

More info: https://docs.unrealengine.com/latest/INT/Programming/Assets/AsyncLoading/index.html https://wiki.unrealengine.com/TAssetPtr_and_Asynchronous_Asset_Loading

more ▼

answered Sep 07 '15 at 03:17 AM

avatar image

xulture
246 5 12 20

(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