Godot Version
v4.3.stable.arch_linux
Question
I have a Resource to store player inventory, and isolated the game breaking code, to some unrun code that is quite innocuous.
This, dispite not being called (according to debugger), breaks things in the resource.
if item is HealthItem:
pass
No related errors and breakpoints suggest code not run, but my resource for items that are HealthItem show as null. Here is the complete func, that also is unrun.
func item_NOTCALLEDFROMANYWHERE(item):# InvItem)-> void:
if item is WeaponItem:
pass
if item is HealthItem:
pass
Commenting HealthItem statement, and bug gone. Despite unreferencing function.
This works.
func item_NOTCALLEDFROMANYWHERE(item):# InvItem)-> void:
if item is WeaponItem:
pass
#if item is HealthItem:
#pass
I’m still learning Godot, so any ideas as to what to try next to figure out what is going on, are much appreciated.
Using the stacktrace, breaks never occur.
No errors in the debugger.
Any other tools or suggestions, as developing with such black magic is disconcerting and I have not much hair left to pull out.
Thanks is advance for any suggestions. More info below.
Cheers
Dan
playerinv.tres
[gd_resource type="Resource" script_class="Inv" load_steps=25 format=3 uid="uid://cxjv1bkh4h06t"]
[ext_resource type="Script" path="res://Inventory/inv.gd" id="2_lxnvg"]
[ext_resource type="Script" path="res://Inventory/inv_slot.gd" id="2_srt7n"]
[ext_resource type="Resource" uid="uid://dumj1lxvfga26" path="res://Objects/Weapons/fishing_rod.tres" id="2_xigps"]
[ext_resource type="Resource" uid="uid://d1ed7flcg3i56" path="res://Inventory/Health/heart.tres" id="3_16nlk"]
[ext_resource type="Resource" uid="uid://bky30mwsy1ui0" path="res://Objects/Clothing/baseball_hat.tres" id="4_61uol"]
[ext_resource type="Resource" uid="uid://4f4t3lcjt6q5" path="res://Inventory/Items/goldfish.tres" id="5_w77qw"]
[ext_resource type="Resource" uid="uid://c860hmkxd7pf2" path="res://Objects/Weapons/sword.tres" id="5_xd347"]
[ext_resource type="Resource" uid="uid://bv3h1mf5il37i" path="res://Inventory/Items/egg.tres" id="6_0bnev"]
[ext_resource type="Resource" uid="uid://cld6ekiqhvsaf" path="res://Inventory/Items/yucca_fruit.tres" id="8_51a85"]
[ext_resource type="Resource" uid="uid://ccdba4w8fc4ko" path="res://Inventory/Items/yucca_seed.tres" id="9_fayps"]
[ext_resource type="Resource" uid="uid://bpnv7m0x7vuto" path="res://Objects/Weapons/sickle.tres" id="10_k8wuf"]
[ext_resource type="Resource" uid="uid://cgh0wctvdhfux" path="res://Inventory/Items/worm.tres" id="11_djwyd"]
.....
[resource]
script = ExtResource("2_lxnvg")
slots = Array[ExtResource("2_srt7n")]([SubResource("Resource_jil6i"), SubResource("Resource_m6yxg"), SubResource("Resource_saeee"), SubResource("Resource_a58xb"), SubResource("Resource_bcdxs"), SubResource("Resource_1ijsn"), SubResource("Resource_cwgo3"), SubResource("Resource_ja33a"), SubResource("Resource_w5dwj"), SubResource("Resource_y1563"), SubResource("Resource_mkrtj"), SubResource("Resource_26uwg")])