Master Of Animation, Games & Interactivity
Master Of Animation, Games & Interactivity

While reflecting back on the conceptual context in the previous post , since then, I also went back in the thought process of 'why'. Apart from creating a one stop place to view shared messages on blockchain, a technical why for me is - there's all this open source data on blockchain how can we use it to create interesting environments and visualise it in unity reading realtime through api and further create interactive art or games which leverage blockchain data. I'm diving around coding and API systems with Unity which i haven't much before and something always wanted to explore. API system i was able to do since yesterday opens many more possibilities for visualising data with unity, and a heaps of learning unity api itself which opens a world of new internet interactivity and games!

First tries with API in unity > 

The API returns a json with all the details, now we need to read it and structure it in unity as players(blocks) with properties so we can do interactive stuff within unity.

j a very good resource (shoutout to hizi) where you can copy paste and see the structure of json and understand it to create in unity.

coding for unity - c#

structuring , spawning updating calling - i learnt heaps here, a major is dictionary and actions and passing lists and json around structures and scripts in c# in unity. Instead of creating chaos in single scripts, im also starting to organize and link it properly now.
Dictionary allows us to check if a block is already present and only updates if not, and not messing with previous already there blocks as they will never be changed once set in time in blockchain space. It's much better than using lists as there's no need for multiple for loops checking for each variable which dictionary does very optimizingly.

THIS is the result> each block from, realtime updating every 10 seconds.. with all properties. This opens up so many possibilities to visualize data in unity which hasn't been explored before. 

My next steps are converting HEX input field to UTF8 , so you can view any messages that would have been sent embedded in the blockchain to a specific address.. 
and then creating a good interactive glittery environment in unity!

ref: Consuming RESTful web services in Unity3d and learn how to use the Unity Engine Networking API a gem!

About This Work

By Sahaj Garg
Email Sahaj Garg
Published On: 01/07/2020