Forum begins after the advertisement:
2 issues after part 11
Home › Forums › Video Game Tutorial Series › Creating a Rogue-like Shoot-em Up in Unity › 2 issues after part 11
- This topic has 9 replies, 2 voices, and was last updated 1 year, 1 month ago by Pavel Fára.
-
AuthorPosts
-
October 9, 2023 at 6:37 am #12017::
Heloo i have 2 issues after part 11. I changed player sprite to my own sprite (with animations), adjusted scale, colliders and rigidbody for player and also increased radius of collector. But 2 issues apeared (no erros in code or console) Issue 1: When i pick up exp gems i dont get experience (worked fine before changing sprite)
Issue 2 Magnet stopped working completely. (worked fine before changing sprite)
I havent done any changes to the code only changed sprite.
Any tips?October 9, 2023 at 2:45 pm #12022::Hi Pavel,
Double check to make sure that all the player components like
PlayerStats
,InventoryManager
, etc. and child GameObjects like the player collector are there.If you are still unable to find the issue, will you be able to upload a video to illustrate this? In the video, select your player character and make sure the inspector for your player GameObject is showing.
October 9, 2023 at 5:10 pm #12027October 9, 2023 at 9:13 pm #12035October 9, 2023 at 9:15 pm #12036October 11, 2023 at 1:04 pm #12068::Hi Pavel, I’ve unflagged your post from spam, but it seems like the images are not found, so they don’t appear properly. Can you try uploading the images to Imgur again?
October 12, 2023 at 10:41 pm #12072::Hi thanks i managed to fix the problems myself.
for Error 1: the experience wroked but i wasnt updating the experienceBar on every pick up of expGem
For Error 2: Magnet stopped working because of animation on pickups. i fixed it by disabling the animation script when players colllider collides with pickup collider code: collision.gameObject.GetComponent<PickUpAnimation>().enabled = false;
October 12, 2023 at 10:44 pm #12073::Hi i dont know if to satrt new post or i can post here but i got 1 more issue, that i am unable to solve myself. i get NullReferenceException when player levelsup (upgrade screen shows only 1 option without set values) when i click the error it sends me to GameManager script to
<code> public void StartLevelUp() { ChangeState(GameState.LevelUp); playerObject.SendMessage("RemoveAndApplyUpgrades"); }</code>
the issue beign the:
playerObject.SendMessage("RemoveAndApplyUpgrades");
October 29, 2023 at 12:27 pm #12128::Hi Pavel, sorry I missed your other question. Whenever you see a NullReferenceException, you want to look at the objects you are accessing the properties of. In this case, the error is probably caused by:
public void StartLevelUp() { ChangeState(GameState.LevelUp); playerObject.SendMessage("RemoveAndApplyUpgrades"); }
So I would do a print on
playerObject
to see if it is null:public void StartLevelUp() { ChangeState(GameState.LevelUp); print(playerObject); playerObject.SendMessage("RemoveAndApplyUpgrades"); }
If it is, you have to figure out why it is null. You can check the Inspector as you play the game to see when / why the variable becomes null.
October 29, 2023 at 4:02 pm #12025 -
AuthorPosts
- You must be logged in to reply to this topic.
Advertisement below: