Jump to content

Tutorial Scripts Unity3D add GameObject And prefab


Recommended Posts

some tutorial to add the scripts to the gameobject in Unity3D?

 

to work when I insert the script to the Scripts folder.

 

help!!

 

When we export our unity assets into the Asset bundles (unity3d files), the scripts kept with the game object, but only as text objects; they are not compiled.

 

We are still working on an effective way to attach these types of scripts to the game during boot up and run time.

Link to comment
Share on other sites

  • 9 months later...

Hi!

 

I could use a little help too. I attached a script to one of my game objects in unity(its just a simple MonoBehaviour script) its called "myscriptone". Then i done all the necessary steps made a .unity3d from the prefab, put the block in blocks.xml so on. (It works just fine when i do not add a script). Then i put the script named "myscriptone" into Scripts folder.

In the blocks.xml i wrote <property name="Class" value="myscriptone, Mods" /> under my game object and i built it with SDX.

I start the game and when a map loads i get "Exception: Class 'Blockmyscriptone, Mods' not found on block My_Block".

So the question is how can i make it work, how to add properly a script to gameobject in Unity?

Link to comment
Share on other sites

At last i figured it out. The script u attach to the object in the xml has to be derived from BlockPowered (i guess simple Block works too but didnt try) and i created my "logic" class (named "myscriptone" as i wrote above, which is derived from MonoBehaviour) in its OnBlockEntityTransformBeforeActivated method and i added it to the object (AddComponent()) there as well.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...