Quantcast
Channel: Questions in topic: "attach"
Viewing all articles
Browse latest Browse all 168

get child and assign it to a transfrom variable.

$
0
0
hello all thanks in advance, here we go: i have a ship, with a child object as the "Gun Tip", i instantiated this ship after the "ship selection menu". after the instantiation i assign it a script with the ship controllers, properties, etc.. i was able to assign all its properties, like movement speed, fire rate, even the bullet prefab, but i cant assign it the gun tip position, wich is a child object of the ship istelf. i leave you some code: //used to instantiate the ship and give it its properties, public void play () { if (p1Reference.ship1 == true) { p1 = Instantiate (instShip1, p1Position.position, p1Position.rotation) as GameObject; p1.AddComponent (); shipRef = p1.GetComponent (); shipRef.playerNumber = 1; shipRef.bullet = bulletRefPlay; shipRef.moveSpeed = 8; shipRef.fireRate1 = 1; } i dont know if im explaining myself correctly, my english is not the best, so any help or any direction is appreciated. thanks, :)

Viewing all articles
Browse latest Browse all 168


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>