A partial solution to "transfering data between CoBlocks and Script

one simple option for transferring any text from CoBlocks to Script (only one direction is supported):

  1. Create a text item in the Scene
  2. Define it as participating in CoBlocks
  3. Define it in Script as well (using Scene.getItem())
    4, Set a timer (schedule each frame) in Script
  4. Set the callback to read the text and perform any desired action
  5. You can transfer any text from CoBlocks even a complete JSON

Nice hack @Zohar_Oicenter. You can also use CoSpace Properties (global variables) to share data between Typescript and CoBlocks.

See Scene.getProperty and Scene.setProperty - Scene | CoSpaces API

Geoff @ TechLeap

In my experience, sharing properties doesn’t work.

Ahh, you’re right - I made this demo 2 years ago, and it was a bug then:

@CoSpaces_Edu please pass this bug on to the devs. Good solution @Zohar_Oicenter !

1 Like

Thanks @techleapnz this has been passed on :slight_smile:

1 Like

Hey @techleapnz - this was done by design and isn’t a bug :slight_smile:

The CoBlocks properties and the Space/Scene properties are two different properties that don’t interact with each other and they have different scopes.

1 Like

We understand that these two set of properties can’t exchange data. We are asking that they will. Or alternatively provide another way for script and Coblocks to exchange data.

And that’s the importance of documentation. This is confusing as it is currently. I doubt it’s a feature that they don’t reference the same CoSpace Properties, but more just the result of having different coding systems for Typescript and CoBlocks, but wanting to provide similar functionality.

It seems strange that both systems can access the same Item properties, but not the same CoSpace Properties.

Thank you for confirming this - it would be great if it can be added to the documentation so there is no further confusion.

Many thanks,