- Home /
Create multiple instance of a mesh with a shader
Hello everybody,
I would like to write a shader that creates several instances of the same object at different positions (which would be parameters of my shader).
Is it possible to do? Are there some existing example to do that? (I'm not good in shader programming ^^)
Thank you very much, Best regards,
BigBulle
Answer by roamcel · Apr 10, 2012 at 04:19 PM
I don't think that you would use a shader for this, or at least, you most certainly WILL need a script for your shader.
What you usually do in these cases, is to create a prefab of your gameobject, and create a script that spawns it!
Thank you very much for your answer! This is what I'm doing now with an editor script but I have to many instanciated object in the scene. I could of course trigger the creation of these objects in play mode when the camera is close to them but I don't know how I can efficiently trigger this creation of objects. I have many spots where these objects can be created, so computing distances between the them and the camera would take to many resources. If you have an advice regarding that I would be really interrested
Your answer
Follow this Question
Related Questions
How to force the compilation of a shader in Unity? 5 Answers
Cross Section Shader 1 Answer
incorrec number of arguments to numeric type constructor 1 Answer
Multiple lighting models in one shader 1 Answer
How to use mesh data in shader 0 Answers