I create 2D game and I need Instantiate GameObjects (lines) in child, but when I set position to 0,0,0 in Instantiate my objects Instantiates in the center of scene but their position is 759, -150, -9720.
By arrows I show place where I want to Instantiate lines
My Instantiate code
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpectrumPartManager : MonoBehaviour
{
public SpectrumPartObject spectrumPartObject;
public void Start()
{
for (int i = 0; i < spectrumPartObject.linePositions.Length; i++)
{
Instantiate(spectrumPartObject.linePrefab, spectrumPartObject.linePositions[i], Quaternion.identity,
transform);
}
}
}
ScriptableObject where I get position
[CreateAssetMenu(fileName = "Spectrum", menuName = "Spectrum")]
public class SpectumSettings : ScriptableObject
{
public float spectrumLineWidth;
public Vector3[] linePositions;
public GameObject linePrefab;
}
