Skip to content

Instantly share code, notes, and snippets.

@snlehton
Last active November 21, 2017 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snlehton/cd2fedcfe3d298f35d6d81ec2dec6ee1 to your computer and use it in GitHub Desktop.
Save snlehton/cd2fedcfe3d298f35d6d81ec2dec6ee1 to your computer and use it in GitHub Desktop.
using UnityEngine;
public class SpawnTest : MonoBehaviour
{
// a prefab containing SpawnTestPrefab
public GameObject prefab;
void Start()
{
Instantiate(prefab, new Vector3(100, 0, 0), Quaternion.identity);
}
}
//...
using UnityEngine;
public class SpawnTestPrefab : MonoBehaviour
{
// Use this for initialization
void Start()
{
Debug.Log("[" + Time.frameCount + "] Start " + transform.position);
}
void OnEnable()
{
Debug.Log("[" + Time.frameCount + "] OnEnable " + transform.position);
}
void Awake()
{
Debug.Log("[" + Time.frameCount + "] Awake " + transform.position);
}
}
/*
...
log output:
Unity 5.6.1p3
[1] Awake (100.0, 0.0, 0.0)
[1] OnEnable (100.0, 0.0, 0.0)
[1] Start (100.0, 0.0, 0.0)
Unity 5.6.4p2 & Unity 2017.2.0f3
[1] Awake (0.0, 0.0, 0.0)
[1] OnEnable (0.0, 0.0, 0.0)
[1] Start (100.0, 0.0, 0.0)
EDIT:
Works in Unity 2017.2.0p2 (no idea which fix)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment