Content-Length: 21172 | pFad | https://docs.unity3d.com/ScriptReference/../Manual/../ScriptReference/MonoImporter.SetIcon.html

Unity - Scripting API: MonoImporter.SetIcon
Version: Unity 6.5 (6000.5)
LanguageEnglish
  • C#

MonoImporter.SetIcon

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public void SetIcon(Texture2D icon);

Parameters

Parameter Description
icon The custom icon to associate with the imported MonoScript. When the value is null, Unity restores the default icon.

Description

Sets a custom icon to associate with the imported MonoScript.

MonoScripts can have an associated custom icon. This icon is used in the Scene view, the Inspector, and the Project window.

Additional resources: MonoImporter.GetIcon, PluginImporter.SetIcon, EditorGUIUtility.SetIconForObject.

using UnityEngine;
using UnityEditor;

public class Example { [MenuItem("Examples/Set Custom Icon on MonoScript")] static void SetCustomIconOnMonoScript() { var monoImporter = AssetImporter.GetAtPath("Assets/MyMonoBehaviour.cs") as MonoImporter; var icon = AssetDatabase.LoadAssetAtPath<Texture2D>("Assets/MyIcon.png");

monoImporter.SetIcon(icon); monoImporter.SaveAndReimport(); } }








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://docs.unity3d.com/ScriptReference/../Manual/../ScriptReference/MonoImporter.SetIcon.html

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy