Skip to content

Instantly share code, notes, and snippets.

View iaincollins's full-sized avatar
🌶️

Iain Collins iaincollins

🌶️
View GitHub Profile
@iaincollins
iaincollins / Cloud Save Object Example.md
Last active August 9, 2024 17:56
How to use Objects with Unity Cloud Save

How to use objects with Unity Cloud Save

A lot of developers trip up on how best to seralize and deseralize data when using Unity Cloud Save, specifically they often save objects as strings rather saving them directly as objects and sometimes run into problems as a result.

This happens either because people are used to how versions of the Cloud Save SDK used to work, because they don't realise that you can save objects without converting them to a string, or because they don't realise that the approach they are using causes them to be seralized.

If saved as a string instead of directly as an object, data can be more complicated to work with than it needs to be, you won't be able to use features like filters to query on the saved data and if you are viewing in somewhere like the Unity Cloud Dashboard it will just be rendered as a single long escaped string (which is hard to read and even harder to edit).

[The sample that com

@iaincollins
iaincollins / SignInWithUnityExample.cs
Last active August 1, 2024 15:35
Unity Player Account Sign In Example
using UnityEngine;
using Unity.Services.Authentication;
using Unity.Services.Authentication.PlayerAccounts;
using Unity.Services.Core;
public class SignInWithUnityExample : MonoBehaviour
{
async void Awake()
{
await UnityServices.InitializeAsync();
@iaincollins
iaincollins / Unity Cloud Save - How to find and match players.md
Last active September 24, 2024 19:32
Unity Cloud Save - How to find and match players.md

How to use Cloud Save to find and match players

This guide describes how you can use Unity Cloud Save to find players by name (or any other property).

This functionality is supported in Cloud Save SDK for Unity and the C# and JavaScript SDKs for Unity Cloud Code.

1. Create Indexes for the keys you want to query on

Before saving data, first define an Index for the keys you want to query on (e.g. in the Unity Cloud Dashboard or using the Unity CLI) so that you can query on these keys.

@iaincollins
iaincollins / Unity Cloud Save - How to find players using Queries.md
Last active September 24, 2024 19:33
Unity Cloud Save - How to find players using Queries

How to use Cloud Save to find players using Queries

This is an example of how to do you can find a player using data stored in Unity Cloud Save by using Indexes and Queries.

This is supported in Cloud Save SDK for Unity and the C# and JavaScript SDK for Unity Cloud Code.

1. Create Indexes for the keys you want to query on

Before saving data, first define an Index for the keys you want to query on (e.g. in the Unity Cloud Dashboard or using the Unity CLI) so that you can query on these keys in the next step.

@iaincollins
iaincollins / Elite Dangerous Events.txt
Created April 9, 2023 13:02
A list of events in Elite Dangerous
Elite Dangerous Events
https://elite-journal.readthedocs.io/en/latest/
Journal Events
Cargo
ClearSavedGame
Commander
Loadout
Materials
@iaincollins
iaincollins / Markdown.md
Created September 15, 2022 22:08
Aalternate light/dark images with GitHub Flavour Markdown
Logo
@iaincollins
iaincollins / pizza-filter-long.js
Created March 19, 2020 01:50
Pizza Filter (long and short form example)
// Long form example
const pizzas = [
{
name: 'Margarita',
toppings: ['Cheese', 'Tomato']
},
{
name: 'Hawaiian',
toppings: ['Cheese', 'Tomato', 'Ham', 'Pineapple']
},
@iaincollins
iaincollins / deploy.yml
Created February 4, 2020 00:29
Example GitHub action to place somewhere like .github/workflows/deploy.yml
name: Deploy on push to master
on:
push:
branches:
- master
jobs:
deploy:
name: deploy
runs-on: ubuntu-latest
steps:
@iaincollins
iaincollins / auth.js
Last active November 12, 2019 23:02
Script to fetch images from Flickr
// 1. Add your API key and secret below
// 2. Run `npm i flickrapi` to install the SDK dependency
// 3. Run 'node auth.js` and follow the instructions
// (will open browser window, need to paste number back in terminal and copy entire output)
const Flickr = require('flickrapi')
const FLICKR_API_KEY = 'YOUR-API-KEY'
const FLICKR_SECRET = 'YOUR-API-SECRET'
Flickr.authenticate({
@iaincollins
iaincollins / Keybase.md
Created November 27, 2018 10:52
Keybase.md

Keybase proof

I hereby claim:

  • I am iaincollins on github.
  • I am iaincollins (https://keybase.io/iaincollins) on keybase.
  • I have a public key ASDf9ymZvYwN7R-sHq0yoHEa8kvW_5i1MmIK_cbroZLEBAo

To claim this, I am signing this object: