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 actor from class, with same component as the target ?

Hello there ! I got another little problem for my game, it's very simple but I don't know how to solve it after many issues ! It's pretty simple :

I create a Blueprint Props_BP, which has a float variable "Matiere", and a Static Mesh component. So when I drag and drop it into the scene i can easly put some differents values for differents blueprint.Until there, no problem. One of my mechanics I want it's when I press "&", the target touch by the raycast spawn the SAME actor with same variables and same static mesh. I made work the float by an "expose on spawn" and a cast ( check the image below), so it's work, but the static mesh component don't have a "Expose On Spawn" so I create the class with same variable, but with no Static Mesh :/

Please help !! thank you ! ( sorry for my english, not a native)

alt text

Product Version: UE 4.16
Tags:
3.png (187.6 kB)
3.png (187.6 kB)
more ▼

asked Feb 27 '18 at 10:16 AM in Blueprint Scripting

avatar image

beckk974
12 1 1 4

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

1 answer: sort voted first

If you add a second component "mesh" to your character, leave the "inherited" character mesh blank. On begin play set that mesh component then make it a variable and expose that variable on spawn. So you should be able to change the mesh that way you just need to make it a variable.

more ▼

answered Feb 27 '18 at 12:55 PM

avatar image

Nebula Games Inc
5.4k 28 9 14

avatar image beckk974 Feb 27 '18 at 01:38 PM

I don't understand all... You want me to add a second component "mesh" to my character but it's the component I need casting ( Props_BP). alt text

Like this, you see my float MatiereProps, i can take this from my SpawnActorFrom(this)Class in my thirdpersoncharacter, but can't get the staticmesh component Thanks

4.png (159.8 kB)
avatar image Nebula Games Inc Feb 27 '18 at 02:53 PM

Sorry misunderstood, but here is a BP example of what I mean. You don't need a new mesh but you do need to "set mesh" in the "Props_BP" by dragging off the static mesh component, "set mesh" and make it a variable that you can then expose on spawn. So from any other BP you spawn the "Props_BP" from you will be able to set the static mesh. Hope this helps! Let me know if this is what you are looking for. alt text

close-up.jpg (87.4 kB)
avatar image ThompsonN13 Feb 27 '18 at 03:24 PM

You could drag off the return value of the spawn and say set mesh from there too. The return balue is a reference to the object that was created.

(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