【问题标题】:How to add image or logo in Unity C# script to show on Inspector Window?如何在 Unity C# 脚本中添加图像或徽标以显示在 Inspector Window 上?
【发布时间】:2017-05-31 00:13:54
【问题描述】:

我正在尝试在我自己的脚本中添加 图像/徽标,如下例所示。在 Google 和 Unity 论坛中搜索了很多,但没有直接找到我。我想在我的脚本中添加我自己的图像/徽标,以便它显示在我的脚本顶部的 inspector 窗口。 请参阅下面标有红色标记的示例。

这是我的示例代码:

using UnityEngine;
using System.Collections;

public class MyScript : MonoBehaviour {

public int speed = 20;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {

}
}

【问题讨论】:

  • 您不必将所有 Unity 问题中的每个文本都加粗。发布您的 Inspector 脚本,以便我们知道您需要帮助的地方。

标签: c# unity3d editor inspector


【解决方案1】:

您可以使用DrawPreviewTexture 并提供您的徽标。你可以从资源中加载你的纹理。

【讨论】:

猜你喜欢
  • 2017-12-01
  • 2021-02-16
  • 2019-04-03
  • 1970-01-01
  • 2021-07-14
  • 1970-01-01
  • 2021-04-13
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多