[SOLVED] Why doesn't this work? (setting a property but reading always returns zero)

I’m using Init event to set a property in another logic tree but reading it always returns zero.
I’ve confirmed that the correct value is being sent to the x property. There aren’t any other locations that are setting the x property.

ok, the problem is more fundamental.
I stripped everything except a simple test print to the console and it doesn’t print. I keep looking at the trait in case it’s not enabled but I can’t find anything wrong.

To share properties between different logic trees, you need to use variable trees (they have special UI in the logic nodes editor). Have you set yours up? If not, here’s a tutorial on how to set them up:

thanks for the reply. good to know that even if I fix a different problems right now, it still would have not worked without you advice.
So any ideas about my followup post that reveals the problem I’m having with even trying to print a simple text in an otherwise empty tree? I’m stilll experimenting with the thought that something got corrupted, which means just delete and rebuild from scratch.

A few questions:

  1. Are you absolutely sure you’ve stated the logic node tree to run at runtime via the objects tab, traits section?

    • I have personally wondered sometimes why my logic node code doesn’t run at runtime, only to figure out my logic node tree wasn’t even setup to run at runtime.
  2. Any errors in the console when you run Armory?

  3. When in doubt, tried clearing your project’s cache. It affects logic nodes as well.

something is so wrong. I’ve stripped out EVERYTHING Armory related and just left the addon installed and the World backdrop.
I get an error that there is no camera even it’s not true. I deleted the camera and added a new one and voila, no error. Which explains (I guess) why I could pan around with the mouse, since it must have defaulted to the viewport camera. (and the q key moves the camera on the Z axis so several problems have been explained)
Also, the basic cube I have in view of the camera disappeared. It’s all enabled to see and render in the Blender viewport but it’s just not even in the debug console. If I delete the cube and make a new one, then it appears fine. I dropped in a sphere alongside the original cube and the sphere shows but not the cube next to it.
My q key assigned to Shutdown node also stopped working.
I’m currently using Win11. I also tried installing Armory on another laptop with Win10 and it behaved the same way.
I’m using Arm build 2023.9, Blender 3.6.3, and the custom Krom file needed for the background-image bug.
The attached file has minimal parts to show the problems: Scene camera not recognized and cube not visible to Armory. (I’ve had camera’s go bad in Blender before (twice in…um… last decade?), took me forever to trace the problem to a corrupted camera)
arm2.blend (274.6 KB)

1 Like

In your scene, the Camera and Cube objects are exported but are not spawned. The Spawn checkbox is disabled for both. Please enable it.

P.S. I feel sorry that you had to go through this rather silly issue. It happens to the best of us sometimes. :sweat_smile:

1 Like

Do tell…my thought was ‘spawning bullets or enemies’.
It works now! Thanks!
Those problems were a spiraling mess trying to troubleshoot something else.
So…back to my original problem, which I just now figured out (variables are not being assigned in the right order)

1 Like