아래 코드를 보자

 

1
2
3
4
5
6
7
int priority(); 
 
void processWidget( std::tr1::shared_ptr<Widget> pw, int priority ); 
 
... 
 
processWidget(new Widget, priority()); //컴파일 에러

 

이 코드가 컴파일 에러가 나는 이유는 std::tr1::shared_ptr 의 생성자는 explicit 되어있기때문에 new Widget 같은 표현식이 올수 없다.

 

processWidget(std::tr1::shared_ptr<Widget>(new Widget), priority());

 

위의 코드는 컴파일에 문제가 없다.

하지만, 스마트 포인터로 받은 자원을 흘릴 가능성이 있는 함수다.

 

왜 그럴까?

C++함수는 함수를 호출할때 함수로 들어오는 인자의 평가 순서를 지니게 된다.

첫번째 인자는 (new Widget) 과 std::tr1::shared_ptr의 생성자 호출부분으로 나뉜다.

두번째 인자는 함수포인터로 함수의 호출문이 있다.

 

우선 위의 함수가 호출될때 컴파일러는 세가지 연산을 위한 코드를 만든다.

 

1. priority를 호출한다.

2. new widget 을 실행한다.

3. std::tr1::shared_ptr 생성자를 호출합니다.

 

이 연산이 실행되는 순서는 컴파일러 제작사마다 다르다.  

 

우선  std::tr1::shared_ptr은 new widget 이 실행되야지만, 실행되는 순서이다. 그렇기 때문에 순서가 변하지는 않지만, priority는 처음 호출될수도 있고, 두번째, 세번째도 호출될 수도 있습니다.

 

이때 2번과 3번 중간에 priority 함수가 호출되서 예외가 발생했다면, 자원을 막아줄줄 알고 준비한 std::tr1::shared_ptr에 저장되기도 전에 예외가 발생합니다.

 

위와같은 문제를 해결하기 위해서는?

 

 

어찌되었든 가장중요한 건!!

ProcessWidget 함수가 호출되기전에 Widget을 생성해서 스마트 포인터에 저장하는 코드를 별도의 한문장으로 하나 만들고, 그 스마트포인터를 넘기는 것입니다.

 

std::tr1::shared_ptr<Widget> pw( new Widget );

processWidget( pw, priority() );

 

이것 만은 잊지 말자!

◆ new로 생성한 객체를 스마트 포인터로 넣는 코드는 별도의 한 문장으로 만듭시다. 이것이 안되어 있으면, 예외가 발생될 때 디버깅하기 힘든 자원 누출이 초래될 수 있습니다.



메모리 할당의 순서(new)

1) 메모리 할당

2) 할당된 메모리에 대해 한 개 이상의 생성자 호출

 

메모리 해제의 순서(delete)

1) 할당된 메모리에 대해 한 개 이상의 소멸자 호출

2) 메모리 해제

 

배열을 위해 만들어지는 힙 메모리에는 대개 배열원소의 개수가 박혀 들어갑니다.

이 때문에 delete 연산자는 소멸자가 몇 번 호출 될지를 쉽게 알수 있습니다.

 

int *i = new int[5];

delete i;

 

int형의 공간 다섯개만큼의 메모리를 할당했지만,delete는 단일 객체만을 해제한다고 표시했기 때문에,

메모리가 모두 해제되지 못합니다.

 

typedef로 정의된 어떤타입의 객체를 메모리에 생성하는것은 주의를 해야한다.

왜냐하면?

 

typedef std::string AddressLines[4];  // AddressLine으로 정의하고

std::string *pal = new AddressLines; // 이렇게 생성하게 되면 나중에 명확하지 않아 혼동될수 있습니다. 배열타입을 typedef 타입으로 만들지 않는 것이 좋습니다. ( vector<string> 사용 합시다 )

 

 

즉! 

new -> delete 씁시다. 

new [] -> delete[] 씁시다.

 

이것 만은 잊지 말자!

◆ new 표현식에 [] 썼으면, 대응되는 delete 표현식에도 []를 써야합니다. 마찬가지로 new 표현식에 []를 쓰지 않았으면, 대응되는 delete 표현식에도 []를 쓰지 말야야 합니다.




Quickly and easily add professional tweener animations to Unity UI.

Features:

• Add tween animations to Unity UI.
• Adjustable parameters such as Translation, Rotation, Scale, Fade, Audio, Time, Delay, Easing, Audio etc.
• Categorizes animation settings.
• Ignores time scale.
• Supports UnityEvents.

• Contains internal tweener.
• Compatible with four popular free tweeners; DOTween, HOTween, iTween and LeanTween.
• Able to add custom tweeners.
• Able to play AudioClip with animations.
• Uses preprocessor directives to examine tweener before actual compilation.

• Supports all Canvas Render Modes.
• Supports all UI Scale Modes.
• Supports Sprite Atlas UI.
• Supports all Unity build player platforms.

• Contains 38 demo scenes.
• Contains c# sample scripts.
• Manual and Class Reference in package.

Compatible:

• Unity 2017.3.1 or higher.

More Details:

GUI Animator for Unity UI is a very easy-to-use UI animations tool. Not needing to learn too much, you can be professional of UI Motion Tween. Using it you can not only animate GUI, but also manages Audio and Particles.

GUI Animator for Unity UI categorizes tween functions into Inspector tab. You can easily navigate to config Translation, Rotation, Scale, Fading, Time, Delay, Easing, UnityEvents and Audio with ease.

GUI Animator for Unity UI is compatible with all Canvas Render and Canvas Scale Modes. It supports individual Sprite and Atlased Sprite elements. GUI Animator for Unity UI also supports UnityEvents , lets you manipulate animations via scripts.

Asset version: 1.2.0




'0x0010 > Unity Asset' 카테고리의 다른 글

Bubble Shooter Match 3 Complete Project  (0) 2019.02.16
Smooth Sync v3.15  (0) 2019.02.16
LipSync Pro v1.44  (0) 2019.02.13
Easy UI Motion v1.1.4  (0) 2019.02.13
7 Painted Cartoon Skyboxes v1.0  (0) 2019.02.13
LipSync Pro


LipSync Pro is an editor extension for creating high-quality lipsyncing and facial animation inside Unity.
Supported on desktop, mobile and console.

Core Features:

- Easy to use Clip Editor for synchronising dialogue.
- Custom inspector with Pose Editor.
- Also includes Emotion and Gesture Markers, allowing for more nuanced animation.
- Randomness modifiers to create more lifelike movements.
- Presets system allows for quick character setup with many different character systems or on large projects.
- Supports both blend shape and bone transform based workflows out of the box.
- BlendSystems allow LipSync to work with many different animation systems. Use our own support for several 3rd-party assets, or create your own.
- Animations are not tied to a character, so lines of dialogue can be shared between characters without any further work.
- Includes a free copy of EyeController, to easily add some life to your characters.

Clip Editor Features:

- AutoSync allows you to easily sync clips in just 2 clicks!
- See a real-time preview of your animation as you create it in the Clip Editor.
- Hold a particular phoneme for any length of time, great for shouting or singing.
- Built around ease-of-use, with features such as:
- Zoom/Pan Timeline
- Marker multi-selection
- Rebindable Keyboard Shortcuts

Asset version: 1.44



'0x0010 > Unity Asset' 카테고리의 다른 글

Smooth Sync v3.15  (0) 2019.02.16
GUI Animator for Unity UI v1.2.0  (0) 2019.02.13
Easy UI Motion v1.1.4  (0) 2019.02.13
7 Painted Cartoon Skyboxes v1.0  (0) 2019.02.13
Love/Hate v1.9.5  (0) 2019.02.13



Easy UI Motion allows you to animate your 2D full screen interfaces made with Unity UI, easily and visually.

Manage Opening /closing effects, or simple effects on element or groups of elements that make up your interface.

Easy UI Motion uses the new events system, that allow you to chain and manage the elements of your interface, without writing a line of code.

Two Components :
* Open/Close
* Simple/Rewind

Animate your items on the following actions :
* Position
* Rotation
* Scale
* Transparency

Personalized your effect :
* The easing
* The time for action
*etc..

Link your motions :
* With event system (WYSIWYG)
* With build in API

Creating funny interface has never been easier, by simply adding EasyUIMotion components to the UI element you want to animate.

Asset version: 1.1.4



'0x0010 > Unity Asset' 카테고리의 다른 글

GUI Animator for Unity UI v1.2.0  (0) 2019.02.13
LipSync Pro v1.44  (0) 2019.02.13
7 Painted Cartoon Skyboxes v1.0  (0) 2019.02.13
Love/Hate v1.9.5  (0) 2019.02.13
Project Search & Replace v1.7.0  (0) 2019.02.10



Get seven beautiful Painted Cartoon Skyboxes for your projects

This package contains the following 7 Skyboxes:

> Ls Cartoon

> Ls Cartoon 02

> Ls Cartoon 03

> Ls Cartoon 04

> Ls Cartoon 05

> Ls Cartoon 06

> Ls Cartoon 07


Each skybox is composed of 6 textures, each texture is in psd format with dimensions of 2000 X 2000 pixels in a skybox / 6sided material.

Asset version: 1.0




'0x0010 > Unity Asset' 카테고리의 다른 글

LipSync Pro v1.44  (0) 2019.02.13
Easy UI Motion v1.1.4  (0) 2019.02.13
Love/Hate v1.9.5  (0) 2019.02.13
Project Search & Replace v1.7.0  (0) 2019.02.10
Memory Game Starter Kit v1.1  (0) 2019.02.10



Love/Hate is a relationship and personality simulator for Unity. It models characters’ feelings about each other using emotional states and value-based judgment of deeds.

With Love/Hate, your characters will…

…have personalities and emotional states.
Love/Hate uses powerful, customizable personality and emotional state models.

…maintain relationships.
Love/Hate tracks how different characters and groups (factions) feel about each other, allowing you to define a dynamic web of social ties among your characters.

…judge and remember deeds.
Characters witness deeds committed by others, judge them according to their own personality and relationships, and remember them.

…and gossip with other characters.
Characters share memories realistically, allowing news of actions to spread organically.

Love/Hate lets you create complex characters that react emotionally to what’s actually happening in the game.

Love/Hate is the product of several years of research and development in realtime simulation of emotions and value-based appraisal, incorporating the latest academic and industry strategies. It works great in 3D and 2D, and includes complete, fully documented source code as well as support for:

• Hutong Games’ PlayMaker
• Ludiq's Bolt
• Opsive's Behavior Designer
• ICE Creature Control
• Icebox Studio's Adventure Creator
• Black Horizon's Emerald AI
• Pixel Crushers’ Dialogue System for Unity
• Pixel Crushers’ Quest Machine
• Gaming is Love's Makinom
• Gaming is Love's ORK Framework
• PLYoung's plyGame and plyBlox
• Paradox Notion's Node Canvas
• CallumP's TradeSys
• Opsive's UFPS
• UtopiaWorx Zone Controller & Zone Controller Pro

Asset version: 1.9.5



'0x0010 > Unity Asset' 카테고리의 다른 글

Easy UI Motion v1.1.4  (0) 2019.02.13
7 Painted Cartoon Skyboxes v1.0  (0) 2019.02.13
Project Search & Replace v1.7.0  (0) 2019.02.10
Memory Game Starter Kit v1.1  (0) 2019.02.10
Ultimate Mobile Pro v2019.2.8  (0) 2019.02.10




http://www.thisisgame.com/webzine/news/nboard/4/?n=91154

+ Recent posts