Hi guys,
I tried to cast to my character, but it shows the warning: does not inherit from ‘character’.
What can I do to solve this problem.
Thank you all in advance.
Hi guys,
I tried to cast to my character, but it shows the warning: does not inherit from ‘character’.
What can I do to solve this problem.
Thank you all in advance.
Hello, try next steps:
1.Find your character in the viewport.
2.Click on it.
3.Go to Details.
4.Search “tag”
5.On Actor → Tags press + to add Array element.
6.Change/Rename “None” to a name you desire. For example “MyJackal”.
7.Go to your HealthBarWidget.
8.Go to Graph.
9.Go to the Event Graph.
10.Go to Variables.
Click +Variables to create a new variable.
Rename newly created variable to something like “MyMainActor”.
13.Set variable type to Jackal_BP → Object Reference. (Just search your blueprint class in the variable type drop menu.)
14.In Event Pre Construct do next as it is shown in this picture below:
Now you have a reference on your Viewport actor/pawn/character and you can use it as a variable as example shown below, also without casting it.
I hope it works for you, and I hope you understand the solution.
Hint : Dont use Get All Actors of Class in Event Tick, its a slow operation.
Hint 2: MyPlaneActor is the same as MyMainActor, i just changed variable name while working on the answer, dont get confused about it.