Reputation: 37
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using System;
namespace ModernMirror.App
{
public class IconPropertView : PropertyView
{
SVGImage icon;
public Sprite[] icons;
void Awake()
{
icon = GetComponent<SVGImage>();
}
override public void SetProp(object id)
{
int i = 0;
try
{
i = int.Parse((string)id);
}
catch(Exception e)
{
Debug.Log("Could not parse integer from property id " + id + e);
}
if (icons == null || i >= icons.Length)
{
Debug.LogWarning("Missing icons for IconProperty " + name);
return;
}
icon.sprite = icons[i];
}
}
}
I am building unity project and got this error. error CS0246: The type or namespace name 'SVGImage' could not be found (are you missing a using directive or an assembly reference?)
Upvotes: 0
Views: 1113
Reputation: 1
Try adding
using Unity.VectorGraphics
per https://docs.unity3d.com/Packages/[email protected]/api/Unity.VectorGraphics.SVGImage.html
Upvotes: 0