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"

Initializing FObjectFinder to create paper sprite assets that can be used throughout the class

Hey I'm currently wondering what the best way to initialize all your FObjectFinder methods to find the sprite assets saved in the editor. I was originally being a idiot and tried to use those methods outside of the constructor to organize my code but currently I can not think of a good way to initialize all my sprite assets easily.

For my game I have a gun asset which the player has attached to the root component which is a paper2dsprite too, both are paper2d sprites, and I want to make a system where I can easily interchange the sprite of that component during run time in game when you pick up a object. I know there is probably some guide or tutorial but I have been looking around and just overall have been having trouble coming up with a efficient system to do this. If you know of something that would help me please link it below. Is there a way to make a struct array of FObject Finders in the constructor, or is that inefficient anyways I'm curious what the best way to implement this system is using c++.

To reiterate my goal is to have a system where you can walk up to a gun asset on the ground and equip it to your player and hold it in your hand. Currently I just want to switch the papersprite that has no asset to a visible sprite when my OnInteraction() method is fired(it is fired when you pick up the gun). For some reason I am just hitting a road-block coming up with a good way to do so, any advice would be helpfull thanks!

Product Version: UE 4.12
Tags:
more ▼

asked Aug 10 '16 at 01:06 PM in C++ Programming

avatar image

gandalfmight
21 1 1

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

1 answer: sort voted first

Edit: I'm being silly I think a much better system then the one I am trying to create here would be to simply just create a gun class seperate from my pickup gun class, and when you interact with the pickup gun it will destroy the pickup gun and construct a new GunClass that is attached to the playerpawn! This way I have access to all the constructor helper methods and it is easily flexible, So I guess I sort of thought my way through this problem already haha.

more ▼

answered Aug 10 '16 at 01:20 PM

avatar image

gandalfmight
21 1 1

(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