Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

How to get objects size for use in other developed application?

Discussion in 'Scripting' started by xtr33me, Nov 5, 2018.

  1. xtr33me

    xtr33me

    Joined:
    Nov 2, 2011
    Posts:
    90
    I've got a strange request that I hope someone might be able to shed some light on. I currently am working on an HTML5 2D front end where I want someone without programming knowledge to be able to drag various objects into a canvas to setup a room lets say using 2D. Then I want to save the placement of those objects out to JSON and then instantiate my prefabs that represent those object in a unity world.

    I'm not allowing them to scale the items in the 2D world, but they will be able to rotate them. I'm trying to figure out how to be able to get a relative size that I can use across these completely 2 different environments. Any ideas?

    Thanks in advance!

    Dan
     
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,594
    I would say is more General, or Game Design question, rather than scripting.

    But well, if scale is not involved, you know exactly what size objects are in both environments.
    Assuming you got predefined prefabs, which match in both environments.
    You can always send objects default scale in json to Unity.
     
    xtr33me likes this.
  3. xtr33me

    xtr33me

    Joined:
    Nov 2, 2011
    Posts:
    90
    Thanks Antipodish. I ended up just making each of my object prefabs align with the grid and then created a scale of my own where a 100px represented a block. Goign to be testing on HTML5 side today, but figuring it should do what I want. Thanks for the assist.
     
    Antypodish likes this.