Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
This question was closed Apr 10, 2017 at 09:23 AM by jamescauwelier for the following reason:

Solved before passing moderation

avatar image
0
Question by jamescauwelier · Apr 10, 2017 at 09:25 AM · extensions

[SOLVED] How to use multiple object fields in custom editor?

I am creating a custom window with multiple object fields. Whatever I do I can only get 1 field to work and accept TextAssets. The XmlFile attribute works, the other two don't.

They look exactly the same to me and I really can't tell what I'm doing wrong. It could be something very simple as I am very new to Unity.

Any help is much appreciated!

UPDATE

I was assigning to Font instead of FontMetadata in the third call to .ObjectField(). Assigning to the proper field fixed the issue completely.

 using System.Collections;
 using System.Collections.Generic;
 using UnityEditor;
 using UnityEngine;
 
 public class CustomWindow : EditorWindow
 {
     public TextAsset Font;
 
     public TextAsset XmlFile;
 
     public TextAsset FontMetadata;
 
     [MenuItem("Window/XML")]
     public static void ShowWindow()
     {
         var window = EditorWindow.GetWindow(typeof(CustomWindow), false, "Custom import");
         //window.Show();
     }
 
     public void OnGUI()
     {
         GUILayout.Label("Import settings", EditorStyles.boldLabel);
         EditorGUIUtility.labelWidth = 100;
         this.Font = (TextAsset)EditorGUILayout.ObjectField("Font", this.Font, typeof(TextAsset), true);
         this.XmlFile = (TextAsset)EditorGUILayout.ObjectField("XML file", this.XmlFile, typeof(TextAsset), true);
         this.Font = (TextAsset)EditorGUILayout.ObjectField("Font metadata", this.FontMetadata, typeof(TextAsset), true);
 
         EditorGUILayout.BeginHorizontal();
         GUILayout.Space(100);
         bool clicked = GUILayout.Button("Process");
         EditorGUILayout.EndHorizontal();
         if (clicked)
         {
             Debug.Log("Should be processing now");
         }
     }
 }
 
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

97 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

A way for multiple people to work on the same game world at the same time? 0 Answers

we need to publish a project for xbox360 (extensions for pc) 0 Answers

UI scroll to selection - unityUIExtensions? 1 Answer

Does anybody know how to import a stamp-pack in Gaia 2 ? 0 Answers

How to include editor extensions in plugin? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges