Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

405
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!