简体   繁体   中英

Unity3D Console Warning: Not derived from MonoBehaviour or ScriptableObject

I'm new to C#, and I'm trying to understand this console warning. This is a simple class I'm storing some data inside. Am I using elements from MonoBehaviour?

using UnityEngine;
using System.Collections;

public class TileType {

    public string name;
    public GameObject tileVisualPrefab;
}

When attaching scripts to game objects they must inherit from monobehaviour. If a property of that class is a simple c# class like your example then that will be fine, it would not need to inherit from mono.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM