StackOverFlow problem

manscom

Member
Hi there

I am designing my buy system in the shop menu and I want the item to remove when sold out.
But I am facing a StackOverFlowException in the console after I added the RemoveItem() function in the BuyItem() function in the demo ShopGeneric script please see the image below螢幕截圖 2021-06-16 下午9.11.38.png
so what i mean is whenever an item being sold out and removed from the item collection then the error will occurs like the image shown below螢幕截圖 2021-06-16 下午9.16.59.png

I have also recored a video for your reference, please check the below link

Thank you
Man
 
Interesting, I haven't seen that error before.
Does the error give any information about where it happens or why? If possible share the full Error Stack such that we can identify where the issue starts.

A stack overflow usually means an infinite loop, but looking at your code I don't really see where it could be coming from.

If all you need is to remove and/or add items when you buy or sell items to the Shop, there is already a component built in for that. It is called: ShopAddRemoveBinding. It's a component you set next to you Shop component. It listens to the Buy and sell events, and removes or adds items accordingly.
 
Interesting, I haven't seen that error before.
Does the error give any information about where it happens or why? If possible share the full Error Stack such that we can identify where the issue starts.

A stack overflow usually means an infinite loop, but looking at your code I don't really see where it could be coming from.

If all you need is to remove and/or add items when you buy or sell items to the Shop, there is already a component built in for that. It is called: ShopAddRemoveBinding. It's a component you set next to you Shop component. It listens to the Buy and sell events, and removes or adds items accordingly.
Problem has fixed , thanks for your help!
 
Top