From 80b9ac2bb19db308deab4c3500aed930e90a15a4 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 21 Apr 2018 13:01:00 +0200 Subject: [PATCH] Create prefab placer --- Assembly-CSharp.csproj | 1 + Assets/Scripts/InstantiateOnClick.cs | 18 ++++++++++++++++++ Assets/Scripts/InstantiateOnClick.cs.meta | 11 +++++++++++ 3 files changed, 30 insertions(+) create mode 100644 Assets/Scripts/InstantiateOnClick.cs create mode 100644 Assets/Scripts/InstantiateOnClick.cs.meta diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj index 67e4bdd..1fd1a47 100644 --- a/Assembly-CSharp.csproj +++ b/Assembly-CSharp.csproj @@ -60,6 +60,7 @@ + C:/Users/stepi/Code/ld41/Library/ScriptAssemblies/UnityEditor.StandardEvents.dll diff --git a/Assets/Scripts/InstantiateOnClick.cs b/Assets/Scripts/InstantiateOnClick.cs new file mode 100644 index 0000000..43fdc0b --- /dev/null +++ b/Assets/Scripts/InstantiateOnClick.cs @@ -0,0 +1,18 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class InstantiateOnClick : MonoBehaviour +{ + public GameObject original = null; + + void Update () { + if (Input.GetMouseButtonDown(0)) + { + if (original != null) + { + Instantiate(original, transform.position, transform.rotation); + } + } + } +} diff --git a/Assets/Scripts/InstantiateOnClick.cs.meta b/Assets/Scripts/InstantiateOnClick.cs.meta new file mode 100644 index 0000000..81daa58 --- /dev/null +++ b/Assets/Scripts/InstantiateOnClick.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 081ef29388dfb6347a06f44d55a176d8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: