I using this tutorial to make my game
if want to use the playerController like this toturial
My question i only have to port my input from character class to my playercontroller
I using this tutorial to make my game
if want to use the playerController like this toturial
My question i only have to port my input from character class to my playercontroller
Hello
First this isn't a player controller question, it's sending a message between two classes.
The way I will show you here is a hundred times easier than what most tutorials teach.
First you need to understand the idea: You have two classes/ blueprints that one of them needs to receive a message from the other.
The problem is that the one class has no idea where the other class is or how many there is.
Edit:
Format wasn't planned, works for a tutorial.
Vid added to show real time effect.
Here is the end scene:
It is a lot of the same class/ blueprint called "Target". There is two lights. We want the first light to to get the color of the first target. We ant the second light to get the color of the target named Bob.
Also to get the color of a material in Unreal it's easier if we set the material color to a parameter and call it "ColorOfMaterial".
Now with this done we go into the Blueprint of the light.
We add a "Get all actors of class" function to our update event.
The actor we are looking for is called "Target" as you can see in the first image.
Now because there can be more than one blueprint in the level of the same type, Unreal will give us a list of objects of the type.
Now because we only want the set the light to the color of the first object, we tell unreal to take the 0 object on the list. Computers count 0-1-2-3...
Once we have the 0 object on the list, we want it's material so we can get the color stored in the material; first we must get the material.
Now that we have the first object in the scene, grabbed it's material we can get the color.
Color is stored as a vector value (Red,Green,Blue,Alpha).
Because all color in the Unreal uses the same color vector we can just plug the color from the material into the color of the light.
OK, We are done.
The color of the light will now be the same as the color of the material from the other blueprint.
Setting the second light is as easy as using a branch/ if to check for the name:
We use a for loop to check each object in the list of "Target".
We get the object name and compare it to the name we want, I named that target "Bob".
We set the color of the second light to the color of "Bob".