Search Unity

DrawBuffers() got a range of indices but no index buffer

Discussion in 'General Graphics' started by Kalita2127, Jul 9, 2019.

  1. Kalita2127

    Kalita2127

    Joined:
    Dec 6, 2014
    Posts:
    279
    I got an error
    DrawBuffers() got a range of indices but no index buffer
    when using the script from the tutorial on youtube. It's an old tutorial but I don't see any problem with his script. I'm following his tutorial and lot of particle system properties has changed in the newest unity (I'm using unity 2019 and he is using unity 5).
    His script:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. public class ShurikenBakedMeshEmitter : MonoBehaviour {
    4.    
    5.     [Tooltip("Mesh you want to use with particles")]
    6.     public SkinnedMeshRenderer skin;
    7.     // Save the current shape of the mesh used
    8.     Mesh baked;
    9.     // Particle system used for playback
    10.     ParticleSystem particle;
    11.     ParticleSystemRenderer render;
    12.     [Tooltip("Particle playback / stop")]
    13.     public bool emit;
    14.     [Tooltip("Interval to emit particles (seconds)")]
    15.     public float coolDown = 0.5f;
    16.     // Current waiting time
    17.     float interval = 0;
    18.     // Use this for initialization
    19.     void Start () {
    20.         // Stop this script if the source mesh is not specified
    21.         if(!skin)
    22.             this.enabled = false;
    23.         // Access to used particle system
    24.         particle = GetComponent<ParticleSystem>();
    25.         render = GetComponent<ParticleSystemRenderer>();
    26.     }
    27.    
    28.     // Update is called once per frame
    29.     void Update () {
    30.         // If emit is true
    31.         if(emit){
    32.             // Calculation of waiting time
    33.             interval -= Time.deltaTime;
    34.             // If the required waiting time has passed ...
    35.             if(interval < 0){
    36.                 // Play a new GameObject in the scene (a copy of this GameObject)
    37.                 GameObject newEmitter = Instantiate(gameObject, transform.position, transform.rotation) as GameObject;
    38.                 // Direct EmitMesh() to the played GameObject
    39.                 newEmitter.GetComponent<ShurikenBakedMeshEmitter>().EmitMesh();
    40.                 // Reset waiting time
    41.                 interval = coolDown;
    42.             }
    43.         // If emit is false
    44.         }else{
    45.             // Reset waiting time
    46.             interval = coolDown;
    47.         }
    48.     }
    49.     // Make particle play by external access
    50.     public void EmitMesh () {
    51.         // Do not let Update () [false]
    52.         emit = false;
    53.         // Reset the mesh type
    54.         baked = new Mesh();
    55.         // Save the current shape of the mesh used
    56.         skin.BakeMesh(baked);
    57.         // Access to own particle system
    58.         particle = GetComponent<ParticleSystem>();
    59.         render = GetComponent<ParticleSystemRenderer>();
    60.         // Specify the mesh to use in the particle system
    61.         render.mesh = baked;
    62.         // Playback of particles
    63.         particle.Play();
    64.         // Instruction to destroy this GameObject
    65.         Destroy(gameObject, particle.duration);
    66.     }
    67. }
    I'm thinking maybe it's a bug on unity or something I don't know about graphics on unity so hopefully this is the right forum to ask. Any help will be appreciated.
    Thanks
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,283
  3. Kalita2127

    Kalita2127

    Joined:
    Dec 6, 2014
    Posts:
    279
    Hi, yes I already enabled the read/write setting in the import settings. I'm using Unity 2019.1.9f1. Do you think maybe it's because I missed some settings on particle system because in Unity 2019 is a bit different from the Unity 5? Or do I must use Unity 2019.3?
     
  4. Kalita2127

    Kalita2127

    Joined:
    Dec 6, 2014
    Posts:
    279
    Hi I think I just discovered what caused the problem. The particle system using Default-ParticleSystem by default. And when I changed it to Default-Diffuse the error is gone. Probably there's a problem with the shader used in material Default-ParticleSystem. But sadly by using Default-Dffuse the alpha value in setting Color over Lifetime didin't make it transparent. Do you have any suggestions what shader should I use to make the particle goes transparent?
     
  5. Kalita2127

    Kalita2127

    Joined:
    Dec 6, 2014
    Posts:
    279
    SOLVED!! Create new material > Shader: Mobile/Particles/Alpha Blended > change the material on setting Renderer to your newly created material
     
  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,283
    That sounds strange. Can you please file a bug report with a project that shows the original problem?
     
    richardkettlewell likes this.