tolren frank
tolren frank

Reputation: 37

error CS0246: The type or namespace name 'SVGImage' could not be found (are you missing a using directive or an assembly reference?)

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

Answers (2)

Roman Bukin
Roman Bukin

Reputation: 67

Put your *.cs files to "Scripts" directory.

Upvotes: 0

Related Questions