【发布时间】:2019-04-21 02:55:05
【问题描述】:
我在一个类中声明了一个私有结构。
当我尝试使用它时,编译器会引发错误
struct inaccessible due to its protection level
这是 C# 代码:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public class HUDanimator : MonoBehaviour
{
private struct udtThis
{
Color col1;
Color col2;
float wait;
float fade;
}
private udtThis[] m = new udtThis[2];
void Start()
{
udtThis n; //raises the compiler error
n.wait = 0f;
我在这里做错了什么?
谢谢。
【问题讨论】:
-
错误信息是什么?
-
@Fabjan 这是一个编译器错误“HUDanimator.udtThis.wait”由于其保护级别而无法访问