- Home /
Question by
Zymurer · Dec 14, 2018 at 02:06 PM ·
particlesystemeditorguilayoutoninspectorgui
OnInspectorGUI for ParticleSystem type
I am working on a simplified command package but I have a problem with using EditorGUILayout.
public override void OnInspectorGUI() { var semiAuto = target as Shooting;
semiAuto.IsAutomatic = GUILayout.Toggle(semiAuto.IsAutomatic, "IsAutomatic");
semiAuto.shownormal = GUILayout.Toggle(semiAuto.shownormal, "Show the basic variables");
if (semiAuto.IsAutomatic == true) {
semiAuto.count = EditorGUILayout.IntField("Bullet count", semiAuto.count);
}
if (semiAuto.shownormal == true)
{
semiAuto.range = EditorGUILayout.FloatField("Shooting distance", semiAuto.range);
semiAuto.clipCount = EditorGUILayout.IntField("Clip count", semiAuto.clipCount);
semiAuto.clipCapasity = EditorGUILayout.IntField("Clip capasity", semiAuto.clipCapasity);
semiAuto.bulletCount = EditorGUILayout.IntField("Bullet count", semiAuto.bulletCount);
semiAuto.damage = EditorGUILayout.FloatField("Damage", semiAuto.damage);
It basically allows me to able and enable variables whenever I want. However, this is not accepted:
semiAuto.ShootFlash = EditorGUILayout.FloatField("Flash", semiAuto.ShootFlash);
I got two errors:
1- Cannot convert string to float
2- Cannot convert from 'UnityEngine.ParticleSystem' to 'UnityEngine.GUILayoutOption'
How can I fix this? If someone could send a code or give a link to answer for that I will be very thankful.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612183951im_/https://answers.unity.com/themes/thub/images/avi.jpg)