Jump to content

SDX 0.7.1 Scripting tutorial request


Recommended Posts


I am new in modding with SDX and stuck at problem with scripts compilling. Need help!


After creating simple mod from Unity primitives, not much complex than Cube example in SDX package. Which is works fine. I tried to add simple script in Unity to object and stuck on "Behaviour Reference Exception..." or something like that.


I can't solve this problem. Tried to put script in Script folde and PatchScripts - no result.


So I think scripting tutorial needed.


Here my script which i added to object for game. What wrong?


using System;
using UnityEngine;
using System.Collections;

public class TestCubeScript : MonoBehaviour {

   private Vector3 RSpeed = new Vector3 (1.0f,100.0f,0.01f); 

// Update is called once per frame
void Update () {
       this.transform.Rotate(0, RSpeed.x, 0);
       if ( RSpeed.x >= RSpeed.y )
           RSpeed.x = RSpeed.y;
       } else
           RSpeed.x += (RSpeed.z * Time.deltaTime);




Link to comment
Share on other sites

You can't attach the scripts in Unity using the current version of SDX.


Your object needs to be linked to a Block or an Entity and then define a class that will control it in the XML. You can then use that class to hold all your code or inject the other components as needed.


SphereII has some tutorials here


Try downloading some mods and seeing how the code gets done.

Link to comment
Share on other sites


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

  • Create New...