Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example05_DynamicChart.cs 不能正常动态创建PieChart与LineChart #339

Open
andyhebear opened this issue Jan 10, 2025 · 3 comments
Open

Comments

@andyhebear
Copy link

如题,环境全新,使用官方示例学习发现问题

@andyhebear
Copy link
Author

QQ_1736475180587
添加Title失败

@andyhebear
Copy link
Author

原因是因为动态创建的时候( gameObject.AddComponent() )没有执行过 BaseChart.InitListForFieldInfos()
QQ_1736477055947

@andyhebear
Copy link
Author

临时bug修正
打开BaseChart.Component.cs 找到函数 public bool CanAddChartComponent(Type type),修改为下面实现

`` public bool CanAddChartComponent(Type type)
{
if (!type.IsSubclassOf(typeof(MainComponent))) return false;
#if UNITY_EDITOR
if (UnityEditor.EditorApplication.isPlaying&&m_TypeListForComponent.Count == 0) {
InitListForFieldInfos();
}
#else
if (!Application.isEditor&&m_TypeListForComponent.Count == 0){
InitListForFieldInfos();
}
#endif
if (!m_TypeListForComponent.ContainsKey(type)) return false;
if (CanMultipleComponent(type)) return !HasChartComponent(type);
else return true;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant