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 10 months, 2 weeks ago by Pavel Fára.
-
AuthorPosts
-
October 9, 2023 at 6:37 am #12017Pavel FáraParticipant::
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 #12022TerenceKeymaster::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 #12027Pavel FáraParticipant::Wasnt able to record. Here are screenshots. The code looks fine to me.
Player:
Collector:
October 9, 2023 at 9:13 pm #12035Pavel FáraParticipant::I checked the code and everythings look ok.
here i images because i wasnt able to record a video.
Player:
Collector:
<script async src=”//s.imgur.com/min/embed.js” charset=”utf-8″></script>
October 9, 2023 at 9:15 pm #12036Pavel FáraParticipantOctober 11, 2023 at 1:04 pm #12068TerenceKeymaster::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 #12072Pavel FáraParticipant::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 #12073Pavel FáraParticipant::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
public void StartLevelUp() { ChangeState(GameState.LevelUp); playerObject.SendMessage("RemoveAndApplyUpgrades"); }
the issue beign the:
playerObject.SendMessage("RemoveAndApplyUpgrades");
October 29, 2023 at 12:27 pm #12128TerenceKeymaster::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 #12025Pavel FáraParticipant::Checked and it looks fine. Wanst able to make videos but here are screens of everything from player object and its child collector.
Player:
https://imgur.com/ez7svmyCollector:
https://imgur.com/TQsCxAw -
AuthorPosts
- You must be logged in to reply to this topic.
Advertisement below: