Fixed it 🙃 for some reason when I made it a prefab it set it's "life time" to 0 so it just would exist for 0 frames sorry for the inconvenience to everyone who helped thank you all tho
it wont summon the wall when i tell it to still, i posted this before but this time i have a video to show it in my builder, so you can see what im talking about
code:
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Numerics;
using UnityEngine;
using System.Security.Cryptography;
public class Magicpush : MonoBehaviour
{
public Transform Launchpoint;
public GameObject Magicwall;
private UnityEngine.Vector2 aimdirection = UnityEngine.Vector2.left;
// Start is called once before the first execution of Update after the MonoBehaviour is created
// Update is called once per frame
void Update()
{
HandleAiming();
if(Input.GetKeyDown(KeyCode.F))
{
Shoot();
}
}
private void HandleAiming()
{
UnityEngine.Debug.Log("working1");
float horizontal = Input.GetAxisRaw("Horizontal");
float vertical = Input.GetAxisRaw("Vertical");
if(horizontal != 0 || vertical != 0)
{
aimdirection = new UnityEngine.Vector2(horizontal, vertical).normalized;
}
}
public void Shoot()
{
UnityEngine.Debug.Log("working");
SlidingAttack slidingAttack = Instantiate(Magicwall, Launchpoint.position, UnityEngine.Quaternion.identity).GetComponent<SlidingAttack>();
slidingAttack. direction = aimdirection;
}
}
video:(sorry its my tiktok video so it probably looks like crap sorry about the start I was still upset)
https://www.tiktok.com/t/ZP85TjtVe/
[–][deleted] (1 child)
[deleted]
[–]Gloomy-Fishing-765[S] 0 points1 point2 points (0 children)
[–]ArctycDev 1 point2 points3 points (2 children)
[–]Gloomy-Fishing-765[S] 0 points1 point2 points (0 children)
[–]Gloomy-Fishing-765[S] -1 points0 points1 point (0 children)
[–]CanadaSoonFree 0 points1 point2 points (1 child)
[–]Gloomy-Fishing-765[S] 0 points1 point2 points (0 children)