Hi,
We are developing a word game for iOS & Android in Unity. My question is simple and technical related: how to implement a custom UI Text Field?
See the image attached
Hi,
We are developing a word game for iOS & Android in Unity. My question is simple and technical related: how to implement a custom UI Text Field?
See the image attached
Hello, yous question was not specific enought, but i’ll show you a code i have wich gets my inputs on text fields, and convert it to Json files, so i can have all writen in 1 file.
using LitJson; // (Json library ....you gotta download this on the asset store for free if you want to use it)
using System.IO;
using UnityEngine;
using UnityEngine.UI;
public class C_Sist_Json : MonoBehaviour
{
public Abrir_c_Sist C_Sist = new Abrir_c_Sist("", 0, 0, "", 0, "");
JsonData C_Sist_JSON;
[SerializeField] //THIS IS IMPORTANT, if you atach your code to a game object, this will make a black space show when you click the object (on the script component) in wich you'll put your text field
public InputField Assunto_Sist_field = null; //make sure it is PUBLIC
[SerializeField]
public Dropdown Problema_Apresentado_Sist_drop = null;
[SerializeField]
public Dropdown Contrato_Sist_drop = null;
[SerializeField]
public InputField Telefone_do_contato_Sist_field = null;
[SerializeField]
public Dropdown Prioridade_Sist_drop = null;
[SerializeField]
public InputField Descricao_Sist_field = null;
// Use this for initialization
void Start()
{
}
public void Abrir_C_Sist()
{
string Assunto_Sist = Assunto_Sist_field.text; // this will set the inputs into the variables
int Problema_Apresentado_Sist = Problema_Apresentado_Sist_drop.value;
int Contrato_Sist = Contrato_Sist_drop.value;
string Telefone_de_contato_Sist = Telefone_do_contato_Sist_field.text;
int Prioridade_Sist = Prioridade_Sist_drop.value;
string Descricao_Sist = Descricao_Sist_field.text;
C_Sist = new Abrir_c_Sist(Assunto_Sist, Problema_Apresentado_Sist, Contrato_Sist, Telefone_de_contato_Sist, Prioridade_Sist, Descricao_Sist); //setting my public class to my Json
C_Sist_JSON = JsonMapper.ToJson(C_Sist); //organizing the Json file
File.WriteAllText(Application.dataPath + "/Chamado_Sist.json", C_Sist_JSON.ToString()); //where the Json should be Created
}
}
public class Abrir_c_Sist //creating the public class to the Json file
{
public string Assunto_Sist_Json;
public int Problema_Apresentado_Sist_Json;
public int Contrato_Sist_Json;
public string Telefone_do_contato_Sist_Json;
public int Prioridade_Sist_Json;
public string Descricao_Sist_Json;
public Abrir_c_Sist(string Assunto_Sist_Json, int Problema_Apresentado_Sist_Json, int Contrato_Sist_Json, string Telefone_do_contato_Sist_Json, int Prioridade_Sist_Json, string Descricao_Sist_Json)
{
this.Assunto_Sist_Json = Assunto_Sist_Json;//setting variables to Json
this.Problema_Apresentado_Sist_Json = Problema_Apresentado_Sist_Json;
this.Contrato_Sist_Json = Contrato_Sist_Json;
this.Telefone_do_contato_Sist_Json = Telefone_do_contato_Sist_Json;
this.Prioridade_Sist_Json = Prioridade_Sist_Json;
this.Descricao_Sist_Json = Descricao_Sist_Json;
}
}
Do you mean the background?
You can just nest a UI text element inside an Image element
and the UI text has a font property where you can change the font.
Then you can make a Prefab from that, and you’ll have your Custom Text control