Download

AnimInstance inherting

Trying to impement this https://wiki.unrealengine.com/Animation_Blueprint,_Set_Custom_Variables_Via_C%2B%2B

I’m modified code, cause clear example don’t work. Version of unreal 4.9.2
Sorry if i’m doing something stupid, i’m new to c++, but help pls. searched all the web, nothing works. really don’t know what to do

Created null c++ class
My UWomenAnimInstance.h



#pragma once

#include "WomenAnimInstance.generated.h"


UCLASS(Transient, Blueprintable, HideCategories = AnimInstance, BlueprintType)
class UWomenAnimInstance : public UAnimInstance
{
	GENERATED_UCLASS_BODY()

};

UWomenAnimInstance.cpp


#include "Game.h"
#include "WomanAnimInstance.h"

//////////////////////////////////////////////////////////////////////////
// UWomenAnimInstance


UWomenAnimInstance::UWomenAnimInstance(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{
}

void UWomenAnimInstance::happy_SteamInit()
{
	//set any default values for your variables here
	SkelControl_LeftUpperLegPos = FVector(0, 0, 0);
}


Error	1	error code: OtherCompilationError (5)	C:\Users\DEADtm\Documents\Unreal Projects\Game\Intermediate\ProjectFiles\Error	Game
Error	2	error MSB3073: The command ""C:\Program Files (x86)\Epic Games\4.9\Engine\Build\BatchFiles\Build.bat" GameEditor Win64 Development "C:\Users\DEADtm\Documents\Unreal Projects\Game\Game.uproject" -rocket -waitmutex" exited with code -1.	C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets	38	5	Game
	3	IntelliSense: cannot open source file "WomanAnimInstance.h"	c:\Users\DEADtm\Documents\Unreal Projects\Game\Source\Game\UWomenAnimInstance.cpp	2	1	Game
	8	IntelliSense: expected a '{'	c:\Users\DEADtm\Documents\Unreal Projects\Game\Source\Game\UWomenAnimInstance.cpp	9	2	Game
	5	IntelliSense: expected a type specifier	c:\Users\DEADtm\Documents\Unreal Projects\Game\Source\Game\UWomenAnimInstance.cpp	8	52	Game
	10	IntelliSense: identifier "SkelControl_LeftUpperLegPos" is undefined	c:\Users\DEADtm\Documents\Unreal Projects\Game\Source\Game\UWomenAnimInstance.cpp	16	2	Game
	4	IntelliSense: name followed by '::' must be a class or namespace name	c:\Users\DEADtm\Documents\Unreal Projects\Game\Source\Game\UWomenAnimInstance.cpp	8	1	Game
	9	IntelliSense: name followed by '::' must be a class or namespace name	c:\Users\DEADtm\Documents\Unreal Projects\Game\Source\Game\UWomenAnimInstance.cpp	13	6	Game
	7	IntelliSense: reference variable "PCIP" requires an initializer	c:\Users\DEADtm\Documents\Unreal Projects\Game\Source\Game\UWomenAnimInstance.cpp	8	92	Game
	6	IntelliSense: this declaration has no storage class or type specifier	c:\Users\DEADtm\Documents\Unreal Projects\Game\Source\Game\UWomenAnimInstance.cpp	8	86	Game


The Solution

Sorry I had not updated that wiki, PCIP is obsolete, you should use ObjectInitializer now,

I’ve updated the wiki here:
https://wiki.unrealengine.com/Animation_Blueprint,Set_Custom_Variables_Via_C%2B%2B#YourAnimInstance.cpp

Have fun today!

RAma

Files must be named WomanAnimInstance.h and WomanAnimInstance.cpp. Without “U” prefix. They must both be placed in the same directory.

Also, I highly recommend to disable IntelliSense errors, because they most of the time just get in your way without being helpful.