- Server where PHP can be used
- SQLite or MongoDB
For more details, please check Requirements.
If you want to use it locally, you can install it on Xampp.
Download and install the free version from Cockpit. Details of the installation will be omitted.
Set up the Collection. The Name you set will be used later on the Unity side.
Click "ADD FIELD".
Please always set the Key
of Text. Specify Key
or key
for Name.
The added items can be retrieved on Unity with the ID as the Name.
[Serializable]
public sealed class TestCockpitModel : CockpitModel
{
public string Text;
protected override void OnDeserialize()
{
Text = GetString("text");
}
}
You can add constants from Options in Select and Tag.
It's easy to use when converted to enum
.
[Serializable]
public sealed class TestCockpitModel : CockpitModel
{
public ItemType Select;
public enum ItemType { Item1, Item2, Item3 }
protected override void OnDeserialize()
{
Select = GetSelect<ItemType>("select");
}
}
In addition to the following, there are multiple acquisition methods such as GetStrings(key)
.
using System;
using CMSuniVortex.Cockpit;
using UnityEngine;
namespace CMSuniVortex.Tests
{
[Serializable]
public sealed class TestCockpitModel : CockpitModel
{
public string Text;
public long Number;
public Sprite Image;
public bool Boolean;
public Color Color;
public string Date;
public ItemType Select;
public TagType[] Tags;
public enum TagType { Tag1, Tag2, Tag3 }
public enum ItemType { Item1, Item2, Item3 }
protected override void OnDeserialize()
{
Text = GetString("text");
Number = GetLong("number");
Boolean = GetBool("boolean");
Color = GetColor("color");
Date = GetDate("date");
Select = GetSelect<ItemType>("select");
Tags = GetTag<TagType>("tags");
LoadSprite("image", asset => Image = asset);
}
}
}
If you've selected the Addressable-compatible CuvClient, you can use AssetReference.
using System;
using CMSuniVortex.Cockpit;
using UnityEngine.AddressableAssets;
[Serializable]
public sealed class CatAddressableDetails : CockpitModel
{
public AssetReferenceSprite Sprite;
public AssetReferenceTexture2D Texture;
protected override void OnDeserialize()
{
LoadSpriteReference("image", asset => Sprite = asset);
LoadTextureReference("image2", asset => Texture = asset);
}
}
After saving the Field, enter multiple Items arbitrarily as we will conduct a retrieval test.
After inputting the Item, set the Roles so that it can be retrieved from the outside. Click the settings mark at the bottom left
Click ROLES & PERMISSIONS
From "ADD ROLE" at the bottom right, select only Read of the CONTENT's Items created earlier and create it with "CREATE ROLE".
Click Api in the left menu and specify the Role you created earlier. The place to select is hard to understand. Please click the position where the dropdown is displayed in the image.
After setting, it will look like the following. Click "REST" to check if it works correctly.
Perform a GET /content/items/{model} test. Check here to make sure you can retrieve it without problems. If something is wrong, remember to first perform this test.
Move to Unity and enter the required information of CuvImporter
, then click the Import button. If it can be retrieved, it is completed. For detail settings on the Unity side, please see Readme.
Explanation | e.g. | |
---|---|---|
Build Path | Path to generate assets | Assets/Generated/ |
Languages | Specify a language, even if you don't use it, you must select at least one. | English |
Base Url | URL of Cockpit | https://devx.myonick.biz/cockpit/ |
Api Key | Api Key set in Roles | API-a92fac21986ac045e143f07c27c60e09f19ae |
Model Name | Name set in Cockpit Installation | Model |
Select "LOCALES" from the settings mark at the bottom left.
Set the language to the value of SystemLanguage. English should be set as the default language, so set other languages.
Turn on the Localize field of the Item you want to localize.
Then "TRANSLATION" will be displayed in the Item editing screen.