Forum begins after the advertisement:
Canvas bugged.
Home › Forums › Video Game Tutorial Series › Creating a Farming RPG in Unity › Canvas bugged.
- This topic has 14 replies, 3 voices, and was last updated 1 year, 3 months ago by Terence.
-
AuthorPosts
-
July 27, 2023 at 9:26 pm #11658::
This happens like few days ago making my Canvas unable to be showed pretty much bugged. I managed to fix most of it but my inventory had an issue.
How do i fix that?
Also there’s issue with the cabbage being unable to pickup. Its not rendered on the player head, nor registered in the inventory after picking up the invisible cabbage, however the cabbage on the farmable area disappear.
July 27, 2023 at 10:31 pm #11659::Okay it seems that i managed to fix the issue, now its the second bug where the cabbage thing.. hmm
July 28, 2023 at 2:11 pm #11661::Hi Sync, are there any errors that appear on your Console when you harvest the cabbage?
You can also have a look at Part 17 of the series, where a couple of bugs are addressed in the first part: https://blog.terresquall.com/2022/12/creating-farming-rpg-in-unity-part-17/
July 28, 2023 at 4:25 pm #11662::It could be either a UI issue or the Item not registering.
When you pick up the cabbage in the scene, check InventoryManager in the Inspector under the ItemSlots array. Do you see the Cabbage ItemData in any of the slots? If yes, the issue is somewhere with the rendering of the UI.
If not, check the Cabbage prefab. Do you have the Cabbage ItemData assigned?
July 31, 2023 at 4:59 pm #11667::Okay i checked, it seems that when i harvest the cabbage it just disappear. Its not added to the UIManager either. If i have 5 at cabbage in the inventory, it should hold one on the hand when i harvest, 1 cabbage would be on Item Hand Slot and i middle mouse button it will keep to inventory adding the 5 cabbage i have to 6, but it seems that its not adding up. Weird.
August 3, 2023 at 9:43 am #11689August 10, 2023 at 6:26 pm #11729::I uploaded a post, not sure if its uploaded or not.
InventoryManager
Got this error at Part 15 ending.
Moving room room to farm leave this error.
August 10, 2023 at 6:30 pm #11731::Error: duplicate reply detected; it looks as though you’ve already said that. It may seem that theres an issue where when i upload picture it being hidden or something where i am unable to see the post.
August 10, 2023 at 10:49 pm #11732::Hi Sync,
Can you upload your images onto Imgur instead? https://imgur.com/upload
The forum blocks links if you put too many of them together in a post, as that makes the post looks like spam.
August 11, 2023 at 8:16 pm #11735August 11, 2023 at 8:17 pm #11736August 11, 2023 at 8:17 pm #11737August 14, 2023 at 5:22 am #11749::Something is not set.
You can double click the error to get to the line where the NullReferenceExceptions are occurring, and see which variable isn’t set, and then trace it from there.
For instance, it looks like in the case of the InventoryManager,
itemSlot
orinventoryArray
is unset in theStackItemToInventory
function.In the case of the Characters, check if
characterData
is set.August 28, 2023 at 10:16 pm #11728::Heres the InventoryManager
Theres this error at Part 15, ending part.. whats wrong here?
There are many issue i encounter so far such as, going from farming to home would have error
I think its the load time of my computer. Which i am unsure about.August 28, 2023 at 10:32 pm #11851::Hi InoXtic,
Sorry that the forum is flagging your message as spam. I’m looking into it. In the meantime, you will need to avoid posting too many links on your post, as it will cause our anti-spam software to falsely flag it as spam.
NullReferenceException
errorFor the
NullReferenceException
, look at line 52 of yourInteractableCharacter
script. These exceptions are usually caused when you try to access a property that is not there. For example, therb.velocity
line below will cause aNullReferenceException
ifGetComponent<Rigidbody>()
fails to find a component:Rigidbody rb = GetComponent<Rigidbody>(); rb.velocity = new Vector3(5,5,5);
This is because
rb
will benull
if the first line fails. Hence, the code resolves tonull.velocity
. Below is a video explaining more aboutNullReferenceException
errors:Entering town error
For the error when entering town from home, you can double click on the error to show the line of code that is causing the error. Then just do a check to make sure that variable is not null. Something like this:
public void OnLocationLoad(Scene scene, LoadSceneMode mode) { //The location the player is coming from when the scene loads Location oldLocation = currentLocation; //Get the new location by converting the string of our current scene into a Location enum value Location newLocation = (Location) Enum.Parse(typeof(Location), scene.name); //If the player is not coming from any new place, stop executing the function if (currentLocation == newLocation) return; //Find the start point Transform startPoint = LocationManager.Instance.GetPlayerStartingPosition(oldLocation); if (playerPoint == null) return; //Disable the player's CharacterController component CharacterController playerCharacter = playerPoint.GetComponent<CharacterController>(); playerCharacter.enabled = false; //Change the player's position to the start point playerPoint.position = startPoint.position; playerPoint.rotation = startPoint.rotation; //Re-enable player character controller so he can move playerCharacter.enabled = true; //Save the current location that we just switched to currentLocation = newLocation; }
-
AuthorPosts
- You must be logged in to reply to this topic.
Advertisement below: