Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

408
Vistas
how to configurate nested object in Unity's inspector

I tried to create nested object in C# script in Unity and change the values in it.

Class of nested object

using UnityEngine;

public class Replica : ScriptableObject
{
    public string Text;
    public int Speed = 1;
    public int PersonaID = 0;
}

Class with nested object

using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

[CreateAssetMenu(fileName = "Data", menuName = "ScriptableObjects/DialogContainer", order = 1)]
public class DialogContainer : ScriptableObject {
    public Replica[] Replicas; // Here is nested object
    public Sprite[] Avatars;
}

And when I created the ScriptableObject I saw that: Photo of ScriptableObject interface

Here I can only put an instance of the class there, but I cannot configure it.

But i want to change values right in inspector without creating and inserting object of class "Replica" like in InputManager where I can create one more obj in axis, open it and change values in inspector like that. Photo of interface I want to see

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

If u want configurate your class in inspector, that class must be not derived from MonoBehaviour or ScriptableObject and be with tag [System.Serializable] than u can serialize it in nested class without creating instance.

Replica:

[System.Serializable]
public class Replica
{
    public string Text;
    public int Speed = 1;
    public int PersonaID = 0;
}

Dialog Container:

using System.Collections.Generic;
using UnityEngine;

public class DialogContainer : MonoBehaviour{
    public List<Replica> Replicas;
    public Sprite[] Avatars;
}

Than I saw that:Inspector screenshot

over 4 years ago · Santiago Trujillo Denunciar

0

Unless you make a custom editor for DialogContainer, you can't do what you want to do. If you have a parent ScriptableObject that contains a child list of ScriptableObjects, you can't edit each child's fields when you have the parent selected in your Project View.

You will have to edit each child Replica by selecting the Replica instance in the Project View. Then the Inspector will let you edit that Replica.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda