kakanics
kakanics
CC#
Created by kitty on 3/27/2023 in #help
❔ Code is completely skipping over an area
you are using the Input.GetKey function, use the Input.GetKeyDown function instead.. GetKey will return true whenever the key is being pressed while GetKeyDown will return true only once (when you press the key)
6 replies
CC#
Created by EmoEmu_69 on 12/17/2022 in #help
❔ How to use a GameObject's location as the location for Instantiate
'''Instantiate(gameobject, transform.position+offset, Quaternion.identity);''' A vector3 named as offset is used to change the spawn position and the transform.position spawns the object at the position of the object on which the spawner script sits You can create a variable for the Transform component of player and refer to it in your scipt public Transform player; Public GameObject prefab; Publicn Vector3 offset; Void Start(){ Instantiate(prefab, player.position+offset, Quaternion.identity); }
4 replies