Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Edit Custom Assets?

Discussion in 'Scripting' started by marioschluse09, May 18, 2015.

  1. marioschluse09

    marioschluse09

    Joined:
    Jan 7, 2015
    Posts:
    3
    Hi,
    I have follow this tutorial and created my custom asset for a dialogsystem.

    I have two classes:
    Code (CSharp):
    1. public class Dialog : ScriptableObject {
    2.  
    3.     public List<DialogElement> diaologes;
    4.  
    5. }
    Code (CSharp):
    1. [System.Serializable]
    2. public class Question : ScriptableObject {
    3.  
    4.     public string sometext;
    5. //Some more to add
    6.  
    7. }
    When I create a dialog asset,
    the list of his dialog elements is empty.

    How can I add dialog elements via script to this asset?
    I hope you understand my problem.
    Thanks in advance
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,850
    You missed the part of the tutorial where he shows you how to create a dialogue item ;)

    Code (csharp):
    1. public class DialogueAsest
    2. {
    3.     [MenuItem("Assets/Create/Dialogue")]
    4.     public static void CreateAsset ()
    5.     {
    6.         ScriptableObjectUtility.CreateAsset<Dialogue>();
    7.     }
    8. }
     
  3. marioschluse09

    marioschluse09

    Joined:
    Jan 7, 2015
    Posts:
    3
    Hi, thanks for the reply.
    But that's not the problem.
    A "dialog"-asset consist of a list of "dialog elements".
    I can create dialog assets, but I don't know how to add elements to the list of the asset...
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,850
    You should be able to drag the Dialogue asset from the project window into the inspector list item field.