C# Program
C# script to spawn a platform in Unity
//You can use this script in unity for spawning a platform for the player
//This script i also have use in my game
//Game will be pubished soon
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlatformSpawner : MonoBehaviour
{
public static GameObject lastPlatform;
public static GameObject dummyPlayer;
private void Awake()
{
dummyPlayer = new GameObject("dummy");
}
public static void RunDummy()
{
GameObject p = Pool.myPool.GetRandom();
if(p == null) return;
if(lastPlatform != null)
{
if(lastPlatform != null)
{
dummyPlayer.transform.position = lastPlatform.transform.position +
PlayerController.player.transform.forward * 49;
}
}
lastPlatform = p;
p.SetActive(true);
p.transform.position = dummyPlayer.transform.position;
p.transform.rotation = dummyPlayer.transform.rotation;
}
void Start()
{
}
void Update()
{
}
}
Game image that I am Making.
Comments
Post a Comment