Help Needed for Architectural Walkthrough

Hi, I was wondering if anybody can help me with this virtual architectural walk through I’m creating. Keep in mind I’m a noob and don’t know anything about scripting.
OK, so I created this simple virtual walk through in Unity and all I need to do is to be able to target objects (i.e. Wall, furniture) and be able to change their texture during the actual play.
Any help will be much appreciated.

Thanks,

Azeddine.

Azeddine, I think its very easy and i think any intermediate unity developer can make it within one or two days. Even if u want to make it ur self u can find lots of video tutorial just google it.

Ram,
Thanks for the reply. I do want to make it myself. I did find a couple of examples on youtube but I couldn’t find any tutorials.
If you can direct to a specific tutorial that would help me a lot.

Thanks,

Azeddine.

Hey, we are just about to launch (any day now) a program called REALIS3D which would allow you to do everything you have just said and loads more. You just import a .fbx model at run-time and off you go, takes seconds.

If your happy to test it and offer up some feedback you can download the alpha version (any day now) and use it for free. No developer knowledge needed!

:slight_smile:

www.realis3d.com

Thanks realvisual,
I will try your application. The fact of the matter is that I think it’s fun to mess with unity3D and I’d like to create an app similar to yours. Maybe I’ll take some scripting classes or something.

If your objects have a collider on it all you have to do to make it clickable to the mouse is do this…

void OnMouseOver()
	{
		if(Input.GetMouseButtonDown(0))
		{
		//insert your texture swapping code here
		}
	}

here is a good video web site
http://www.burgzergarcade.com/hack-slash-rpg-unity3d-game-engine-tutorial
Its video 111 or 112 or 113 or 114. I forget which one in this series

You can also watch 3d buzz unity3d video.

Thanks for your help. I actually found a good tutorial on youtube by: Envatio.
Basically, he shows how to create a main menu with GUI Texture, when clicked will change the texture of an object in the game.

Thanks for your help again.

But this sounds like not what you wanted. you wanted to click on an object in the building directly, now your clicking on a button to do something to the object. You should take the texture swapping code from the video you found and use it in the getmouseDown event of the object.

Azeddine, u just do one thing, u make one folder in asset folder and name it : “Resources” like this, put ur all textures in that folder; which u want to change at runtime.

Now apply this Code

void OnMouseDown()
{
gameobject.renderer.material.mainTexture=Resources.Load(“yourTextureName”);
}

with the use of this code u can change a gameObject texture at runtime

What I’d do is make a raycasting script that when hits something(use tagging or naming to detect if you want that selected), reference it and then a gui pops up with available settings and textures for that obj that would be pulled from an array in the object. That should offer a lot of customization with ease.
Or to go totally boss you can make an ingame editor, but that takes time and you need to question if it’s worth it.

roto23,

initially, I just wanted to go around in the game and click to swap textures but then I thought it might be nice to have a menu to pick from. Right now, I’m just watching the tutorials and trying what all you guys suggested. I will eventually build games using different techniques and see what works best. I’ll also post them to get you guys’ feed back.

Thanks again,

Azeddine.

Morning,
I’m not really sure what a raycasting script is, but I’ll research it and see if I can do it.
thanks for your help.

Ram,

I tried what you suggested but I’m getting errors. I’ve attached pictures showing you the code as I entered it and the errors I’m getting.

Thanks,

Azeddine.


try this…

gameObject.renderer.material.mainTexture = Resources.Load("Green");

Looks like your camel case is off (The “O” in object should be capitalized and it also look like there is a space between “.Load”

You can apply the material to the variable (javaScript):

var Green : Material;
var Red : Material;
gameObject.renderer.material.mainTexture = Resources.Load(Green);

or Red.

Hey guys,
I tried what you all suggested but I keep getting a bunch of errors. I really have a lot to learn about scripting.
Anyway, I did find these tutorials on youtube and I created a small application (see attached images). Basically the tutorial shows how to create a main menu with GUI textures and be able to swap textures on gameplay. The thing is, the tutorial show texture swapping for one object. When I add a new object and apply the same codes, it all works fine but I can only render one object at the time, meaning when I pick a texture from the main menu it applies it to the object, but when I go back to pick the texture for the second object, it does it but the previous object goes back to the defaut blank texture. So I can only change the one texture at the time.
I’m not sure which code I have to change.
Here are the scripts I used (I insert large spaces between codes):

var Value : String;
function Update(){
DontDestroyOnLoad(this);
}

var Level : String;
function OnMouseUp(){
Application.LoadLevel(Level);
}

var Level : String;

function OnMouseUp(){
var Loader = GameObject.Find(“Loader”);
Destroy(Loader);
Application.LoadLevel(Level);
}

var Kolor : String;

function OnMouseUp(){
var Loader = GameObject.Find(“Loader”);
var VS = Loader.GetComponent(VS);
VS.Value = Kolor;
}

var Me : GameObject;
var Blue : Material;
var Red : Material;
var Yellow : Material;
var Default : Material;

function Update () {
var Loader = GameObject.Find(“Loader”);
var VS = Loader.GetComponent(VS);
var Value = VS.Value;

if(Value == “Blue”){
Me.renderer.material = Blue;
}
else if(Value == “Red”){
Me.renderer.material = Red;
}
else if(Value == “Yellow”){
Me.renderer.material = Yellow;
}

}

var Me2 : GameObject;
var Cyan : Material;
var Green : Material;
var Purple : Material;
var Default : Material;

function Update () {
var Loader = GameObject.Find(“Loader”);
var VS = Loader.GetComponent(VS);
var Value = VS.Value;

if(Value == “Cyan”){
Me2.renderer.material = Cyan;
}
else if(Value == “Green”){
Me2.renderer.material = Green;
}
else if(Value == “Purple”){
Me2.renderer.material = Purple;
}
}

828727--30879--$Capture3.PNG


Sorry, i dont know that u r using javascript, actually in javascript u can define a function with ‘function example(){’ and in csharp its “void example”, so i sent to csharp script example. Anyway i m very happy that u solved ur problem.

Ram,
Well, I haven’t really solved the problem. As you can see in my previous post, i can only change one texture at the time. Can you please look at my codes and tell me how to modify them to be able to change 2 or more textures at a time?

Thanks,

Azeddine.