- Home /
C# line into Javascript help
I downloaded this save and loading thing from the asset store and I have made a script for loading and saving but id prefer it to be in javascript since I don't know anything about c#. I can make it all in javascript but the line where it saves and loads im not sure how to do it in java.
c# code
using UnityEngine;
using System.Collections;
public class SaveMenu : MonoBehaviour {
void OnGUI()
{
if(GUI.Button(new Rect(10, 50, 150, 25), "Save"))
{
transform.GetComponent<AdvancedSaveSystem_SaveGO>().SaveGameObjects(1);
}
if(GUI.Button(new Rect(10, 80, 150, 25), "Load"))
{
transform.GetComponent<AdvancedSaveSystem_LoadGO>().RefreshGameObjects(1);
}
}
}
Answer by robertbu · Oct 02, 2014 at 05:58 PM
You can either rewrite it as:
transform.GetComponent.<AdvancedSaveSystem_SaveGO>().SaveGameObjects(1);
(note the added period) or:
transform.GetComponent(AdvancedSaveSystem_SaveGO).SaveGameObjects(1);
it doesnt identify AdvancedSaveSystem_SaveGO and LoadGO
Your answer
Follow this Question
Related Questions
modifing enemies target inside a radius 1 Answer
How to use "GetComponent" and "transform" code in dll file? 0 Answers
How to enable/disable Javascript using a C# script? 1 Answer
Best Way to make a character move 1 Answer
How to make the player turn left or right only in desired places o edges and not everywhere ???? 0 Answers