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!
asked Aug 10 '16 at 01:06 PM in C++ Programming
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.
answered Aug 10 '16 at 01:20 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here