Цитата из 2D тутора
1. Create a new empty GameObject by going to GameObject>Create Empty. Rename it to “Character Spawn Point”.
2. Apply the script titled SpawnPoint to the GameObject you just created. This script creates that little 2D icon of Lerpz inside the Scene View so you can see where the spawn point is.
SpawnPoint.jsСинтаксис:Используется javascript// This script must be attached to a game object to tell Unity where the player starts in the level.
// We'll draw a gizmo in the scene view, so it can be found....
function OnDrawGizmos() {
Gizmos.DrawIcon(transform.position, "Player Icon.tif");
}
3. Position the spawn point where you want Lerpz to appear. Make sure it is at z = 0 with a platform underfoot, so he actually has a place to stand when he appears.
Ну и дальше нам объясняют, что такое Gizmo и для чего оно нужно. + естественно ссылка на справку.
Так вот делаю все точно так же. Создал GO, переименовал его, создал папку, закинул в нее изображение 32х32 с расширением ".tif", создал скрипт SpawnPoint.cs
Синтаксис:
Используется csharp
using UnityEngine;
using System.Collections;
public class SpawnPoint : MonoBehaviour
{
void OnDrawGizmos()
{
Gizmos.DrawIcon(transform.position, "SpawnPoint.tif");
}
}
using System.Collections;
public class SpawnPoint : MonoBehaviour
{
void OnDrawGizmos()
{
Gizmos.DrawIcon(transform.position, "SpawnPoint.tif");
}
}
Далее вешаю этот скрипт на GO и вместо нужной мне иконки появляется черный квадрат Малевича.
Я, как и завещал нам вождь, пошел другим путем
Синтаксис:
Используется csharp
using UnityEngine;
using System.Collections;
using System;
public class SpawnPoint : MonoBehaviour
{
public Texture2D resp;
void OnDrawGizmos()
{
Gizmos.DrawIcon(transform.position, Convert.ToString(resp));
}
}
using System.Collections;
using System;
public class SpawnPoint : MonoBehaviour
{
public Texture2D resp;
void OnDrawGizmos()
{
Gizmos.DrawIcon(transform.position, Convert.ToString(resp));
}
}
и принудительно в GO прикрутил нужную мне иконку. Но Малевич упорно не хочет покидать баррикады! Подскажите плиз как решить данную проблему.