davidblack09 Posted April 10, 2018 Share Posted April 10, 2018 some tutorial to add the scripts to the gameobject in Unity3D? to work when I insert the script to the Scripts folder. help!! Link to comment Share on other sites More sharing options...
sphereii Posted April 11, 2018 Share Posted April 11, 2018 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 More sharing options...
Iris22 Posted February 5, 2019 Share Posted February 5, 2019 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 More sharing options...
xyth Posted February 5, 2019 Share Posted February 5, 2019 You can not add a script in Unity. Scripts must be loaded from the scripts folder by SDX. Link to comment Share on other sites More sharing options...
Iris22 Posted February 5, 2019 Share Posted February 5, 2019 I removed it from the unity object and still i get the same error. Link to comment Share on other sites More sharing options...
Iris22 Posted February 5, 2019 Share Posted February 5, 2019 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.