- Home /
How to work with a particular prefab instance in unity3d ?
hi guys, I am creating app using unity3d, in that I have the MYSQL db connectivity with c# script which contains the details of objects i.e. id, name , position, height, width ..etc
By taking that values from db I am adding cubes on screen using prefab and Instantiate() method.
I want to assign details from db to cube and display that on MouseClick.
But, problem is It is not considering an instance of prefab as individual object, and unable to show details.
any suggestions and helpful replies are welcome …. thanks...
I'm a bit confused by your question. Typically you would instantiate an object and then set the properties of that object. Something like:
var go = Instantiate(prefab, pos, Quaternion.identity) as GameObject;
go.renderer.material.color = Color.red;
thanks robertbu … for giving time to my question.
I am also confused for what should be the structure of classes in my unity scripts.
Actual Scenario is :
I have to create a huge map such as Yard… In that, on button click , at given position Box (cube) should get created and details of that cube have to get saved in database. When user will open an app next time , Values should get fetched from database and boxes should get generated. Clicking on particular box, details of that should get displayed on side panel.
please guide me what should be the architecture of my app.
Your answer
![](https://koobas.hobune.stream/wayback/20220613122551im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Calling a function from all instances of a script 1 Answer
How to make an object/prefab choose between multiple given positions to spawn into? 1 Answer
Pre-Normalized cube model? 3 Answers
Script is reading from prefab instead of instance 1 Answer
How to have unique instances of script on multiple instances of prefab? 1 Answer