Before I start, I’m sorry for the stupid problem,I feel it’s going to be really easy to solve, but I can’t for the life of me figure this out. I’m new to Unreal Engine 4, and, on top of that, not the best programmer around. I’ve been trying to get a simple gun blueprint to work, but I’ve failed. First, I created an gun blueprint, named GunTest, that inherits from actor blueprint. On the BP, I’ve made a simple method called “Fire”, and under the method, when It’s called, it prints out a message: “Hello”.
Imgur: The magic of the Internet ( The method )
Now under my character blueprint, I cast ‘Self’ to GunTest, which happens on BeginPlay, and, As GunTest, I call the method ‘Fire’ when the Input key ‘Q’ is pressed.
Imgur: The magic of the Internet ( Calling the method )
Most of you probably already figured out why it doesn’t work, but I’ll offer more details. When I run the engine, it says the blueprint didn’t compile correctly, I ran it anyway. I pressed Q, and when I got out of the game, it gave me these errors:
http://i.imgur.com/OJSfqqg.png ( Error in message log )
http://i.imgur.com/CDhX3aj.png ( Error in blueprint Cast )
Well, from what I got out of it, if the gun was a child class to my character, this wouldn’t be happening. But I don’t want to make the gun a child class to my 3rd Person Character, since they share nothing between eachother. Is there any other way to do what I want to do without making the gun inherit from my character?
Also, if you could quickly explain what exactly casting is, that would be great. I’ve read around but I’m not sure if I’ve got the right definition for it.
Thanks for your time