# FObjectFinder.object is null on Tick

**URL:** <https://forums.unrealengine.com/t/fobjectfinder-object-is-null-on-tick/313311>\
**Category:** Rendering\
**Tags:** unreal-engine, UE4, CPP, question\
**Created:** [March 31, 2015, 6:24pm UTC](https://forums.unrealengine.com/t/fobjectfinder-object-is-null-on-tick/313311 "2015-03-31T18:24:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_5be014f9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_5be014f9](https://forums.unrealengine.com/u/anonymous_user_5be014f9)\
**Post date:** [March 31, 2015, 6:24pm UTC](https://forums.unrealengine.com/t/fobjectfinder-object-is-null-on-tick/313311/1 "2015-03-31T18:24:25Z")

</div>

I have the following code:

```
 APracticeProjectCharacter::APracticeProjectCharacter(const FObjectInitializer& ObjectInitializer)
    	: Super(ObjectInitializer)
    {
    	static ConstructorHelpers::FObjectFinder<UMaterialInstance> materialAsset(TEXT("Material'/Game/ThirdPerson/Materials/playerMaterial_Inst.playerMaterial_Inst'"));
    	if (materialAsset.Succeeded())
    		material = (UMaterialInstanceDynamic*)materialAsset.Object;
    }
    
    void APracticeProjectCharacter::Tick(float deltaTime)
    {
    	Super::Tick(deltaTime);
    		material->SetScalarParameterValue(TEXT("power"), maxPowerLevel / powerLevel);
    }

```

I am trying to load material from the assets and change some parameters. On the constructor, material is not null and if I ser paramater value there it works. but on Tick function material is null and it leads to run time error. I understand why this is happaning. material is a UMaterialInstanceDynamic pointer and when FObjectFinder.object dies, materials dies too. but why does it goes null? it is static.

I also have tried to change the contructor for the following:

```
static ConstructorHelpers::FObjectFinder<UMaterialInstance> materialAsset(TEXT("Material'/Game/ThirdPerson/Materials/playerMaterial_Inst.playerMaterial_Inst'"));
    	if (materialAsset.Succeeded())
    		material = UMaterialInstanceDynamic::Create(materialAsset.Object, this);

```

But chainging the paramater is not working. Even if I change it from the constructor.  
How can I get this work?
