- Home /
Question by
adnirjhar · Mar 18, 2015 at 09:33 PM ·
editoreditorwindowcompilation
Assigning class instance to a Gameobject
using System;
using System.Collections.Generic;
using UnityEngine;
public class MyScript : MonoBehaviour
{
public MyScript()
{
Camera.main.backgroundColor = Color.red;
}
void Update()
{
#region Behavior Bouncy
//Some bouncy code
#endregion
}
}
Hi, I am compiling this code snippet from my EditorWindow using CSharpCodeProvider. The code compiles fine from the EditorWindow. But I was wondering if I can assign this MyScript or any instance of that, to my Gameobject so it could use my Update. I am really sorry if the question doesnt seem legit. I am still figuring things out. Thanks.
Comment