Grinya Posted March 23, 2018 Share Posted March 23, 2018 Hi. 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); } } } Thanks! Link to comment Share on other sites More sharing options...
HAL9000 Posted March 23, 2018 Share Posted March 23, 2018 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 More sharing options...
Grinya Posted March 23, 2018 Author Share Posted March 23, 2018 Thank you for help! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.