-3

In my Unity Project when my game runs my world item prefab initiates sprites that don't show on my inventory display only the canvas that can't be seen on screen and it doesn't spawn any collectable objects in the world like it should

Any Help would be greatly appreciated

3
  • 2
    Please provide enough code so others can better understand or reproduce the problem. Commented Nov 11 at 13:30
  • this is my code for collecting items and destroying the item in the world so it diapears after its collected private void OntriggerEnter(Collider other) { ItemWorld itemWorld = other.GetComponent<ItemWorld>(); if(itemWorld != null) { // add to the player's inventory inventory.AddItem(itemWorld.GetItem()); // destroy from world itemWorld.DestroySelf(); } } Commented Nov 13 at 8:47
  • Please format your code when pasting it in the future. Commented Nov 28 at 5:30

1 Answer 1

-1

private void OntriggerEnter(Collider other) { ItemWorld itemWorld = other.GetComponent<ItemWorld>(); if(itemWorld != null) { // add to the player's inventory inventory.AddItem(itemWorld.GetItem()); // destroy from world itemWorld.DestroySelf(); } }

OntriggerEnter should be OnTriggerEnter

Sign up to request clarification or add additional context in comments.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.