- Home /
Scripts on imported objects do not work?
Hello there.
I have recently started learning Unity and have come across a very frustrating problem. I was learning some basic scripting on built in default game objects and thought I'd try them on imported 3D objects. So I switched over to Cinema 4D, created a simple sphere and exported it as a .obj
I imported the 3D object to unity, dragged the object to my scene and attached a very simple script to it.
function OnMouseDown () {
Debug.Log("It works!");
}
The problem is, it doesn't work. Unity isn't calling the click. The script worked perfectly fine attached to built in game objects provided by Unity, but attached to anything else and it's like the script freezes. I tried exporting the Cinema 4D object as a simple .fbx , and that didn't work. I even tried importing the object as a .c4d and unfortunately didn't fix the problem, either.
What did I miss?
Any help would be much appreciated.
Ps. I'm using Unity Pro.
Answer by Eric5h5 · Feb 24, 2013 at 08:03 PM
You need a collider in order for OnMouseDown and related functions to work.
Your answer
![](https://koobas.hobune.stream/wayback/20220613093323im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
I was wondering if i imported an item if i can delete objects in that asset in unity? 0 Answers
Accessing variables from another object? 1 Answer
OnTrigger events on multiple objects 1 Answer
Interact with Objects with scripts 2 Answers
Can I Access Objects or Scripts in an Additive Level? 2 Answers