one simple option for transferring any text from CoBlocks to Script (only one direction is supported):
- Create a text item in the Scene
- Define it as participating in CoBlocks
- Define it in Script as well (using Scene.getItem())
4, Set a timer (schedule each frame) in Script
- Set the callback to read the text and perform any desired action
- 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 !
Thanks @techleapnz this has been passed on
Hey @techleapnz - this was done by design and isn’t a bug
The CoBlocks properties and the Space/Scene properties are two different properties that don’t interact with each other and they have different scopes.
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.