The properties you are referring to; Account
, Stream
, Branch
, Commit
are not settable because they are they are actually of type AccountSelection
, StreamSelection
, BranchSelection
, CommitSelection
etc…
These types have both a list Options
list, and a Selected
property which can be get & set.
E.g.
var receiver = GetComponent<SpeckleReceiver>();
//GETTING THE SELECTION DATA
IReadOnlyList<Account> allAccounts = receiver.Account.Options; //Get all the accounts loaded
Account? selectedAccount = receiver.Account.Selected; //Get the current selected Account
IReadOnlyList<Stream> allStreams = receiver.Stream.Options; //Get all the streams available to selected Account
Stream? selectedStream = receiver.Stream.Selected; //Get the current selected stream
IReadOnlyList<Branch> allBranches = receiver.Branch.Options;
Branch? selectedBranch = receiver.Branch.Selected;
IReadOnlyList<Commit> allCommits = receiver.Commit.Options;
Commit? selectedCommit = receiver.Commit.Selected;
//SETTING THE SELECTION
receiver.Stream.Selected = allStreams[0]; //e.g. Select a specific stream by index
receiver.Stream.Selected = selectedStream; //e.g. Set it back to the original selected stream....
receiver.Account.Selected = AccountManager.GetDefaultAccount();
// REFRESHING OPTIONS
receiver.Stream.RefreshOptions(); //Will fetch the latest streams, branches, and commits for the selected account.
As a bit of a more general overview.
We are expecting users to create their own runtime UI to display a view of the Options
list, and respond to user selection via setting the Selected
property.
Since AccountSelection
, StreamSelection
, BranchSelection
, CommitSelection
all inherit from a generic OptionSelection
, it makes it possible to share the same UI for all types of selection.
And since these components handle all of the fetching of options + refreshing + selection, we hope you don’t need to write any of this from scratch yourself…
You can see an example of the kind of UI we’re thinking about https://youtu.be/Y-RGPZJIHf4?feature=shared&t=31
And here its implemented using an loose MVC structure
If you’d prefer not to use these selection components, there is also a static ReceiveAsync
function where you can pass in selection manually.