Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

particles are pink - creating tex and material

void Start()
{
    createParticleSys();
}

void createParticleSys()
{
    //Create GameObject to hold the Particle System
    GameObject psObj = new GameObject("Particle System");
    //Add Particle System to it
    ParticleSystem ps = psObj.AddComponent<ParticleSystem>();

    //Assign material to the particle renderer
    ps.GetComponent<Renderer>().material = createParticleMaterial();
}

Material createParticleMaterial()
{
    //Create Particle Shader
    Shader particleShder = Shader.Find("Particles/Alpha Blended Premultiply");

    //Create new Particle Material
    Material particleMat = new Material(particleShder);

    Texture particleTexture = null;

    //Find the default "Default-Particle" Texture
    foreach (Texture pText in Resources.FindObjectsOfTypeAll<Texture>())
        if (pText.name == "Default-Particle")
            particleTexture = pText;

    //Add the particle "Default-Particle" Texture to the material
    particleMat.mainTexture = particleTexture;

    return particleMat;
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: call a .NET assembly from C or c++ 
Csharp :: telerik mvc grid editable date no time 
Csharp :: IAuthorizationFilter OnAuthorization AuthorizationContext MyAuthorizeAttribute HttpUnauthorizedResult HttpContext 
Csharp :: Display the elements in an array one at a time using getkeydown in unity 
Csharp :: how to preset an array c# 
Csharp :: exception meaning in .net core 
Csharp :: how to make physics in unity 
Csharp :: tuple parameter name 
Csharp :: get innermost exception c# 
Csharp :: when creating a new boolean column in an existing table how to set the default value as true in c# models code first 
Csharp :: cluster size C: powerschell 
Csharp :: c# with keyword 
Csharp :: stackoverflow array c# 
Csharp :: c# half hour dropdown list 
Csharp :: how to make soft body OBJECT in unity 
Csharp :: unity call function after delay 
Csharp :: .net mvc foreach with index 
Csharp :: c# fill values of child from parent 
Csharp :: convert excel to datatable without xml configuration 
Csharp :: file.deletealltext 
Csharp :: .net core api routing not working 
Csharp :: runner dotnet trace inside docker container 
Csharp :: nullable 
Csharp :: c# custom comment tags 
Csharp :: How to put a (new line) inside a list box 
Csharp :: c# properties making string required 
Csharp :: get fixedupdate interval unity 
Csharp :: cs foreach int 
Csharp :: ddsfsd 
Csharp :: source a listbox by property of object c# 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =