UnityEditor.TriggerModuleUI.CreateDefaultCollider C# (CSharp) Method

CreateDefaultCollider() private static method

private static CreateDefaultCollider ( string name, ParticleSystem parentOfGameObject ) : GameObject
name string
parentOfGameObject UnityEngine.ParticleSystem
return UnityEngine.GameObject
        private static GameObject CreateDefaultCollider(string name, ParticleSystem parentOfGameObject)
        {
            GameObject obj2 = new GameObject(name);
            if (obj2 != null)
            {
                if (parentOfGameObject != null)
                {
                    obj2.transform.parent = parentOfGameObject.transform;
                }
                obj2.AddComponent<SphereCollider>();
                return obj2;
            }
            return null;
        }

Usage Example

Exemplo n.º 1
0
        private void DoListOfCollisionShapesGUI()
        {
            int num = base.GUIListOfFloatObjectToggleFields(TriggerModuleUI.s_Texts.collisionShapes, this.m_ShownCollisionShapes, null, TriggerModuleUI.s_Texts.createCollisionShape, true);

            if (num >= 0)
            {
                GameObject gameObject = TriggerModuleUI.CreateDefaultCollider("Collider " + (num + 1), this.m_ParticleSystemUI.m_ParticleSystem);
                gameObject.transform.localPosition = new Vector3(0f, 0f, (float)(10 + num));
                this.m_ShownCollisionShapes[num].objectReferenceValue = gameObject;
            }
            Rect rect = GUILayoutUtility.GetRect(0f, 16f);

            rect.x     = rect.xMax - 24f - 5f;
            rect.width = 12f;
            if (this.m_ShownCollisionShapes.Length > 1 && ModuleUI.MinusButton(rect))
            {
                this.m_ShownCollisionShapes[this.m_ShownCollisionShapes.Length - 1].objectReferenceValue = null;
                List <SerializedProperty> list = new List <SerializedProperty>(this.m_ShownCollisionShapes);
                list.RemoveAt(list.Count - 1);
                this.m_ShownCollisionShapes = list.ToArray();
            }
            if (this.m_ShownCollisionShapes.Length < 6)
            {
                rect.x += 17f;
                if (ModuleUI.PlusButton(rect))
                {
                    List <SerializedProperty> list2 = new List <SerializedProperty>(this.m_ShownCollisionShapes);
                    list2.Add(this.m_CollisionShapes[list2.Count]);
                    this.m_ShownCollisionShapes = list2.ToArray();
                }
            }
        }
All Usage Examples Of UnityEditor.TriggerModuleUI::CreateDefaultCollider