- Home /
How do I place a script into an object?
http://youtu.be/YI-7p6hDWsE (A video to show you what is happening.)
I'm getting the error with everything, no matter what it is. This is literally crippling Unity for me.
What I'm trying to do is make a script that allows the Particle Emitter to turn on\off when I hold the mouse button down. Here is the script I am trying to use:
using UnityEngine; using System.Collections;
public class Piss : MonoBehaviour {
// Use this for initialization
void Start ()
{
public class ExampleClass : MonoBehaviour {
void Update() {
if (Input.GetMouseButtonDown(0))
Debug.Log("Pressed left click."); Play(withChildren: bool = true): void;
}
// Update is called once per frame
void Update ()
{
}
}
Answer by Linus · Nov 08, 2014 at 04:45 AM
Your script is a total mess :)
using UnityEngine;
using System.Collections;
public class test : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetMouseButtonDown(0))
{
Debug.Log("Pressed left click.");
particleSystem.Play(true);
}
}
}
Although I did take your script, it still will not work :(
@Figerox, You want to make new script name "test" and Than copy and paste above code in that script than it works. because ClassName
public class test : $$anonymous$$onoBehaviour
And file name (here) "test" must be same.
Ahah, Sorry about that man. I'm totally new. I did get it on at least, but it still isn't working the way I would like it to. Thank you anyways! :D
Your answer
Follow this Question
Related Questions
Ending my game 3 Answers
Cant Add Script (or create any new scripts) Javascript 2 Answers
error issues : KeyNotFoundException 1 Answer
Unable to open scripts 2 Answers