示例#1
0
    // Awake
    private void Awake()
    {
#if UNITY_EDITOR
        if (Application.isPlaying)
#endif
        {
            m_rCurrentFrameAtlas            = m_rSpriteSettings.atlas;
            m_rCurrentFrameTextureContainer = m_rSpriteSettings.textureContainer;
            m_iCurrentFrameTextureWidth     = (int)m_rSpriteData.spriteWidth;
            m_iCurrentFrameTextureHeight    = (int)m_rSpriteData.spriteHeight;
            spriteAnimation.Start(this);
        }

#if UNITY_EDITOR
        // Is a prefab instance
        else if (IsADuplicate( ))
        {
            //Debug.Log("Duplicate");
            Uni2DEditorResourceCopyUtils.DuplicateResources(this);
        }
#endif

        // Create the duplicata marker if needed
        if (m_oDuplicataMarker == null || m_oDuplicataMarker.IsADuplicate(this))
        {
            m_oDuplicataMarker = ScriptableObject.CreateInstance <DuplicataMarker>();
            m_oDuplicataMarker.Create(this);
        }
    }
示例#2
0
	// Awake
	private void Awake()
	{
#if UNITY_EDITOR
		if( Application.isPlaying )
#endif
		{
			m_rCurrentFrameAtlas            = m_rSpriteSettings.atlas;
			m_rCurrentFrameTextureContainer = m_rSpriteSettings.textureContainer;
			m_iCurrentFrameTextureWidth     = (int)m_rSpriteData.spriteWidth;
			m_iCurrentFrameTextureHeight    = (int)m_rSpriteData.spriteHeight;
			spriteAnimation.Start( this );
		}
		
#if UNITY_EDITOR
		// Is a prefab instance
		else if( IsADuplicate( ) )
		{
			//Debug.Log("Duplicate");
			Uni2DEditorResourceCopyUtils.DuplicateResources( this );
		}
#endif

		// Create the duplicata marker if needed
		if(m_oDuplicataMarker == null || m_oDuplicataMarker.IsADuplicate(this))
		{
			m_oDuplicataMarker = ScriptableObject.CreateInstance<DuplicataMarker>();
			m_oDuplicataMarker.Create(this);
		}
	}