AEC Interoperability for Unity through Speckle
Перейти к файлу
Matteo Cominetti 6c8e2d3635 feat: updates to use core 2.0.2 2021-02-09 18:12:08 +00:00
.idea/.idea.Speckle Unity feat: updates to use core 2.0.2 2021-02-09 18:12:08 +00:00
Assets feat: updates to use core 2.0.2 2021-02-09 18:12:08 +00:00
Packages
ProjectSettings
.gitignore
LICENSE
README.md

README.md

Connector Unity WIP

Twitter Follow Discourse users website

Introduction

This repo holds Speckle's Unity Connector, it currently is ⚠ WORK IN PROGRESS ⚠, please use at your own risk!

This connector is meant to be used by developers, it doesn't have a UI but it offers convenience methods to send and receive data. The connector currently only supports a subset of all the features and methods in the Speckle .NET SDK.

unity

Developing & Debugging

We encourage everyone interested to debug / hack /contribute / give feedback to this project.

Requirements

  • Unity (we're currently testing with 2020+)
  • A Speckle Server running (more on this below)
  • Speckle Manager (more on this below)

Dependencies

All dependencies to Speckle Core have been included compiled in the Asset folder until we figure out how to best reference Core.

The GraphQL library has been recompiled with a fix for Unity, see https://github.com/graphql-dotnet/graphql-client/issues/318 for more info.

Getting Started 🏁

Following instructions on how to get started debugging and contributing to this connector.

Server

In order to test Speckle in all its glory you'll need a server running, you can run a local one by simply following these instructions:

If you're facing any errors make sure Postgress and Redis are up and running.

Accounts

The connector itself doesn't have features to manage your Speckle accounts, this functionality has been delegated to the Speckle Manager desktop app.

You can install an alpha version of it from: https://speckle-releases.ams3.digitaloceanspaces.com/manager/SpeckleManager%20Setup.exe

After installing it, you can use it to add/create an account on the Server.

Debugging

Open your IDE and click "Attach to Unity and Debug".

How to use

The project showcases how to send and receive data with Speckle in Unity.

In order to run it make sure to first add an account via the Speckle manager.

Accounts

Default account

If you only add one account in the Manager, that will also be your default account. If you have multiple accounts, you can switch default account using the Manager.

image

Some nodes accept an optional "account" input, if not provided the default account will be used.

image-20201031111912748

Sending and Receiving

This connector is meant to be used by developers, it doesn't have a UI but it offers convenience methods to send and receive data. The connector currently only supports a subset of all the features in the Speckle .NET SDK.

Sending

To Send data simply call the Sender.Send(string streamId, List<GameObject> gameObjects, Account account = null) method, it's on a static class so you don't need to initialize it.

Currently only GameObjects with a MeshFilter on them can be sent.

Receiving

To Receive data instantiate a Receiver.cs like so:

var receiver = ScriptableObject.CreateInstance<Receiver>();
receiver.Init(ReceiveText.text);

To receive the data on its last commit and convert it automatically call await receiver.Receive(); .

To automatically receive all new data being sent to the stream, subscribe to new data events like so:

receiver.OnNewData += ReceiverOnNewData;
...
...
private void ReceiverOnNewData(GameObject go)
{
   ...
}

The received GameObject will contain as children a flattened list of all the converted objects.

Currently only Mesh, Lines and points can be received.

Questions and Feedback 💬

Hey, this is work in progress, I'm sure you'll have plenty of feedback, and we want to hear all about it! Get in touch with us on the forum!

Contributing

Please make sure you read the contribution guidelines for an overview of the best practices we try to follow.

Community

The Speckle Community hangs out on the forum, do join and introduce yourself!

License

Unless otherwise described, the code in this repository is licensed under the Apache-2.0 License. Please note that some modules, extensions or code herein might be otherwise licensed. This is indicated either in the root of the containing folder under a different license file, or in the respective file's header. If you have any questions, don't hesitate to get in touch with us via email.