Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
This question was closed Aug 12, 2014 at 04:33 PM by davidflynn2 for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by davidflynn2 · Aug 08, 2014 at 04:10 PM · c#editor

Show model Image in Editor Window

I am trying to make an editor that takes all the models (.dae) from a folder and load them into an window as buttons that are clickable during edit mode not play mode. Any help would be awesome.

Comment
Add comment · Show 5
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
avatar image vexe · Aug 08, 2014 at 04:26 PM 1
Share

What have 'you' tried so far?

avatar image davidflynn2 · Aug 08, 2014 at 04:31 PM 0
Share
 using UnityEngine;
 using UnityEditor;
 using System.Collections;
 
 [CustomEditor(typeof(ObjectBuildingScript))]
 
 public class ObjectBuilderEditor : Editor {
 
     public override void OnInspectorGUI()
     {
         DrawDefaultInspector();
         
         ObjectBuildingScript myScript = (ObjectBuildingScript)target;
         if(GUILayout.Button("Build Object"))
         {
             myScript.BuildObject();
         }
         if(GUILayout.Button("Build Object2"))
         {
             myScript.BuildObject();
         }
     }
 }
 

I have the above working to make the buttons on the editor but I need them to show and image of the models ins$$anonymous$$d of just being a plane button. I would also be willing to settle with just using a button texture I create.

avatar image vexe · Aug 08, 2014 at 04:35 PM 1
Share

Pass in a GUIContent to the button - GUIContent takes a Texture parameter. See the different Button overrides.

avatar image davidflynn2 · Aug 08, 2014 at 04:41 PM 0
Share

Ok so I see what your getting at there but my problem is, its an editor script so its not actualy on an object so I cant place the texture in public texture and set it for the button. What do I have to do different to make it use the texture for an editor script?

 using UnityEngine;
 using UnityEditor;
 using System.Collections;
 
 [CustomEditor(typeof(ObjectBuildingScript))]
 
 public class ObjectBuilderEditor : Editor {
 
     public Texture tex;
 
     public override void OnInspectorGUI()
     {
         DrawDefaultInspector();
         
         ObjectBuildingScript myScript = (ObjectBuildingScript)target;
         if(GUILayout.Button(tex))
         {
             myScript.BuildObject();
         }
         if(GUILayout.Button("Build Object2"))
         {
             myScript.BuildObject();
         }
     }
 }
avatar image vexe · Aug 08, 2014 at 04:43 PM 1
Share

See EditorGUIUtility.Load

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

22 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

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Initialising List array for use in a custom Editor 1 Answer

Move Editor Button 1 Answer

Spawn with rotation of 90 on x axis. 1 Answer


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