Forum begins after the advertisement:
[General] How to change main character
Home › Forums › Video Game Tutorial Series › Creating a Metroidvania in Unity › [General] How to change main character
- This topic has 9 replies, 3 voices, and was last updated 9 months, 2 weeks ago by Anuk Thotawatta.
-
AuthorPosts
-
April 3, 2024 at 11:18 pm #13709::
I used the sprite given in the link in the description to see if the basic mechanics work. now i made a new sprite combining body parts and animating them. I gave it the player controller script and gave the same attributes to it and animated it. But when i insert it to the scene it appears behind everything and is unresponsive. (There are no error messages).
View post on imgur.com
April 3, 2024 at 11:23 pm #13710::Update: it is responsive but it still appears invisible(its sorting layer is the same as the players). And its pivot point is misplaced as seen in the video below.
April 3, 2024 at 11:24 pm #13711April 4, 2024 at 12:02 am #13712::Update 2: the body parts were on the default layer even though the parent object was in midground, that’s why it appeared invisible. And I cant move my characters pivot point because it doesn’t have an avatar for the sprite renderer as it is not a single sprite. What can i do to fix this
April 4, 2024 at 12:04 am #13713::Anuk, your clips are invisible because you just need to paste the Imgur URL like so:
https://imgur.com/a/H2YBe8G
But you put them in IMG tags, which doesn’t work:
<img src="https://imgur.com/a/H2YBe8G"/>
As for the Sprite Sheet pivot points, you should be able to change the pivot point for each sprite in the Sprite Editor: https://discussions.unity.com/t/how-do-i-change-multiple-pivot-points-in-the-sprite-editor/119405
April 4, 2024 at 2:03 am #13715::To add on, I think an easier solution to change all the pivot point of your character to the center is to:
- Select all your character’s body parts.
- Right-click and “Create Empty Parent”. This parent should have naturally been created in the center point of your selected body parts.
- If your empty parent is under another parent object, set it’s Transform Position values to (0, 0, 0).
April 4, 2024 at 3:36 am #13724April 4, 2024 at 3:51 am #13725::View post on imgur.com
this is a minor problem but i want to make my character a bit bigger but after i resize the body parts and move after i run the game, the sprite gets squished sideways
April 4, 2024 at 3:58 am #13727::The reason for the squish is due to the movement code for the Player. We set the X Scale to [1] and [-1] to flip the player every time they change directions.
But this should be no issue if you did this:
- Make sure that the assigned Player (Your PlayerController.cs) is an Empty Parent [Parent 1].
- Place your Character’s sprite under a separate Parent [Parent 2], which is under Parent 1.
- Change the Scale of Parent 2 to the size that you wish.
The order should be [Parent 1] > [Parent 2] > [Character sprites]
Where Parent 1 is your Script and assigned Player & Parent 2 is the center pivot for your Player. Do tell me if this works, since I have not tested this method, purely theory.
April 4, 2024 at 2:56 pm #13730 -
AuthorPosts
- You must be logged in to reply to this topic.
Advertisement below: