public void Register(Type type, Material material) { if (!material.enableInstancing) { Debug.LogWarning("material enableInstance == false"); return; } m_registered[type] = new Tuple <Mesh, Material>(GraphicsUtility.CreateQuad(), material); }
private void Initialize() { if (m_types != null) { Debug.LogWarning("Already initialized"); return; } m_typeToMeshAndMaterial = new Dictionary <Type, Tuple <Mesh, Material> >(); foreach (KeyValuePair <Type, Tuple <Mesh, Material> > kvp in m_registered) { if (kvp.Value != null) { m_typeToMeshAndMaterial.Add(kvp.Key, kvp.Value); } } foreach (KeyValuePair <Type, string> kvp in m_builtIn) { if (m_typeToMeshAndMaterial.ContainsKey(kvp.Key)) { continue; } Material material = Resources.Load <Material>(kvp.Value); if (material != null) { m_typeToMeshAndMaterial.Add(kvp.Key, new Tuple <Mesh, Material>(GraphicsUtility.CreateQuad(), material)); } } int index = 0; m_types = new Type[m_typeToMeshAndMaterial.Count]; foreach (Type type in m_typeToMeshAndMaterial.Keys) { m_types[index] = type; index++; } m_types = GetTypes(m_types); OnIsOpenedChanged(); m_editor.IsOpenedChanged += OnIsOpenedChanged; m_editor.BeforePlaymodeStateChange += OnBeforePlayModeStateChange; m_editor.PlaymodeStateChanged += OnPlayModeStateChanged; }