Score increase with spawned object issue(SOLVED)

I’m having a problem with my logic nodes because I can increase the score when I collide with an object but not when I collide it a recently spawned object. score problem.blend (2.9 MB)

The file you shared is missing a canvas script “MyCanvas”. Please share that as well.

In the canvas I only made a text object name “score”. For some reason I can’t seem to share it with the file.

Hi, I fixed the issue. Here is the blend file: score problem.blend (2.9 MB)

I too cannot upload the canvas here, so you can just use the existing one that you already have.

The problem: you had applied the scoring system to the gas cans. So essentially each gas can had its own score and it started with 0. So, when the vehicle hits the cans, the score will be incremented from 0 to 1. The exact same happens with each gas can and the sore never goes beyond 1. This was fixed by having the scoring system attached to the vehicle, but the detection system still remains on the gas cans.

There was also another issue. You used the “Spawn Object” node. This node can spawn objects only if they are already present in the active scene. node description

So, if you ever remove both gas cans at the beginning, then, no gas can will be spawned later. To overcome this, you may use the “Spawn Object By Name” node. node description

Hope this helps.

Best,
QC

1 Like

Thank, you saved me from dooming me tutorial series :grin:

1 Like