Soldato
- Joined
- 10 Mar 2006
- Posts
- 3,975
One question I promise, before I go and chuck myself into the fire.
What about this code is wrong? I'm trying to instantiate a particle effect in Unity3D using a simple piece of C#. Trying to learn 3D modelling whilst teaching myself programming again.
I get the error
Is 'Instantiate' even a C# operator/thingy? Any help appreciated. If I don't get it working I promise I'll up some photos of my burning carcass.
What about this code is wrong? I'm trying to instantiate a particle effect in Unity3D using a simple piece of C#. Trying to learn 3D modelling whilst teaching myself programming again.
Code:
using UnityEngine;
using System.Collections;
public class CoinPickup : MonoBehaviour {
// Update is called once per frame
void OnTriggerEnter (Collider collision) {
if (collision.tag == "Player") {
GameObject anEffect = Instantiate(CoinEffect, transform.position, transform.rotation) as GameObject;
Destroy(anEffect);
}
}
}
I get the error
Assets/CoinPickup.cs(12,62): error CS0103: The name `CoinEffect' does not exist in the current context
Is 'Instantiate' even a C# operator/thingy? Any help appreciated. If I don't get it working I promise I'll up some photos of my burning carcass.