0 votes

I want to use animation player to change the shape of the characters hitbox based on the attack used, but when resizing the shape of their hitbox through animation player, every other instance of that character scene has their collision shape re-sized as well, not just the one that went through the animation.

Everything else like the transform of CollisionShape2D doesn't affect the other instances of that character, so why is shape different?

in Engine by (12 points)

1 Answer

0 votes

This is by design. The shape property of a CollisionShape2D is a Shape2D resource. Resource objects are passed by reference, so both instances are sharing the same shape resource.

If you want them to be unique you can choose "Make unique" on the resource in the Inspector, or you can duplicate() it in code.

by (20,475 points)

I've chosen "Make Unique", which didn't work for some reason but I found that under "edit" I can tick "Local to scene" which worked, thanks!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.