- Home /
Question by
LPGaming-Company · Jan 23, 2013 at 03:51 PM ·
c#positionvector3
C# Transform modification.
So, I'm a bit stumped here, I know that to do this in C# you have to go about creating a new Vector3, but here's my code.... not really that easy..
public void createNPC(string name, int maxHealth, int expReward, int maxDamage, Vector3 position) {
// Instantiate game object here
GameObject npcGameObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
NPC npc = new NPC();
npcList.Add(npcGameObject, npc);
npcGameObject.transform = position;
I can't really create a new(position), so I'm not sure how I would go about this...
Comment
Best Answer
Answer by vbbartlett · Jan 23, 2013 at 04:11 PM
if you want to set the position of the npcGameobject do it like this
npcGameObject.transform.position = position
Oh wow, I can't believe it was a simple mistake like that, that was keeping me back... There's no telling how many times I've used this code either... -___- thanks
Your answer
Follow this Question
Related Questions
addition of vector3 1 Answer
Guided missile help c# 1 Answer
Script to make Camera follow the player C# 3 Answers
Multiple Cars not working 1 Answer
A node in a childnode? 1 Answer