Problem with dynamic material setting of all static mesh actors

I’m newbie in UE4.
I have tested dynamic material before on a blueprint class and it is work for me.
I wanna get all Static Mesh actors of the scene and change its materials subject to its state.

I have added this script to OnBeginPlay node in Level Blueprint:

I have added this script to Event Tick:

GetStateColor is a function that calculates appropriate color according to state. I have tested it before and it works correctly.

When i play the game nothing happens. The materials of all static meshes is the same default material of UE4.

I don’t have any idea about why this script don’t works while i have tested single blueprint class version of this.

I have only cut all static meshes and paste it again and everythings works now!
I’m surprised! What was wrong with that?