#  TypeError: Cannot read properties of undefined (reading ‘texture’)

**URL:** <https://phaser.discourse.group/t/typeerror-cannot-read-properties-of-undefined-reading-texture/12564>\
**Category:** Phaser 3\
**Created:** [November 17, 2022, 4:41pm UTC](https://phaser.discourse.group/t/typeerror-cannot-read-properties-of-undefined-reading-texture/12564 "2022-11-17T16:41:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![CyborgiCorgi](https://avatars.discourse-cdn.com/v4/letter/c/f05b48/32.png) [@CyborgiCorgi](https://phaser.discourse.group/u/CyborgiCorgi)\
**Post date:** [November 17, 2022, 4:41pm UTC](https://phaser.discourse.group/t/typeerror-cannot-read-properties-of-undefined-reading-texture/12564/1 "2022-11-17T16:41:09Z")

</div>

I am trying to load in animations for my player character but am running into this error. I’m not sure what I’m doing wrong, the error seems to be coming from the setCurrentFrame function in phaser ` gameObject.texture = animationFrame.frame.texture;`

The console log in my create function is returning an entry so i believe i’ve called the animation correctly

```javascript
preload() {
       this.load.atlas('hero', 'assets/images/hero-girl.png', 'assets/images/hero-girl_atlas.json');
       this.load.animation('hero_anim', 'assets/images/hero-girl_anim.json');
   }

   create() {
       this.player = new Phaser.Physics.Matter.Sprite(this.matter.world, 0, 0, 'hero', 'girl-idle-3');
       this.add.existing(this.player);
       this.inputKeys = this.input.keyboard.addKeys({
           up: Phaser.Input.Keyboard.KeyCodes.W,
           down: Phaser.Input.Keyboard.KeyCodes.S,
           left: Phaser.Input.Keyboard.KeyCodes.A,
           right: Phaser.Input.Keyboard.KeyCodes.D,
       });
       console.log('anims', this.anims.anims.entries.hero_walk);
   }

   update() {
      this.player.anims.play('hero_walk');

```

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [November 18, 2022, 6:04pm UTC](https://phaser.discourse.group/t/typeerror-cannot-read-properties-of-undefined-reading-texture/12564/2 "2022-11-18T18:04:24Z")

</div>

Can you show the stack trace?

The error suggests `gameObject` is undefined, which is strange.
