# Unity procedural textures

I'm wanting to have an object that does random animation in Unity, within the object. Basically, I want a floor that has lights that go through it. I'm trying to figure out exactly what is the best way to make that happen. I know there is such a thing as "Procedural Textures" in Unity, but I'm struggling to understand exactly how to make these textures. There are two basic ideas which I have:

1. Attach a script to the object that I want to place the texture on. That class should manage the texture in all senses of the word. This seems clunky, because it won't show up in the scene mode. This texture would then be assigned in the Start() function for said script.
2. There exists tools that make these procedural textures, such as Substance. Currently I don't have much of a budget for game development, so I'd like to stay away from anything with a cost (This is more of a hobby for me right now).

Is this the correct way to think about things, or am I missing something fundamental? There seems to be procedural materials that I can't quite understand how they work. Am I missing something else? Thanks!

EDIT:

What I'm trying to do is to have moving lights go across a floor, either as a part of the floor, or even as contained within the floor. I'm considering using some kind of particle system for it, but I've heard about these procedural textures and I thought it was worth a shot to see if they do something similar. I'm also considering using a randomly generated star skybox using a similar method. Specifically, I'm picturing moving lights going across the floor in this image.

• Can you describe what you want to accomplish with a bit more detail? – Chris Mills-Price Dec 3 '15 at 15:52
• A picture is worth a thousand words. There are a good dozen or so effects I can think of that could be described as "lights going through a floor" and each will have different implementation considerations. Can you add some reference images to get us on the same page? Also, you say a script-based solution won't be visible in the Scene view, but you can make your scripts ExecuteInEditMode too. You can also write custom material shaders without paying for tools like Substance if you're up for getting deep into the code. – DMGregory Dec 3 '15 at 16:25
• Good to know about ExecuteInEditMode, I didn't realize that existed... I should look into shaders, that might be what I really should do. I've posted an image of my game, which should help some. Thanks! – PearsonArtPhoto Dec 3 '15 at 16:29
• Your image still doesn't explain what you mean by "moving lights across the floor" — you just showed us a floor with no moving lights. That doesn't help us see what's in your imagination. – DMGregory Dec 3 '15 at 16:54
• Maybe you just want some spotlights to move around the scene? – Philipp Dec 3 '15 at 18:26

It turns out that the trick was to simplify. @Phillip provided me with a trick, that the easiest thing to do was to create a series of small moving lights, that only rendered on the floor. This creates the moving lights that I was looking for. This shows what I was looking for.

How I achieved this:

1. Create a game object that periodically creates small light sources that move just above the floor.
2. The floor was already on it's own render layer. I specified the light to only affect that layer. I might change my mind on this later, but for now, I like the effect.
3. Apply a slight velocity to the objects, some random color, and away they go!

The code looks something like this:

    GameObject obj = new GameObject();
obj.transform.position = startLocation;