Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by dbarth · May 15, 2014 at 12:51 AM · c#unityeditorversion-controlperforce

UnityEditor.VersionControl and Perforce, tasks always fail?

Hi guys,

I'm trying to write a tool that our artists can use to verify their checkins. We've had a lot of problems with people adding prefabs but forgetting various dependencies.

We are using Perforce (2014 February 25 visual client) with Unity 4.3.4f1, Pro version with Team license, Windows 7 x64. Perforce Plugin turned on and set up in Project Settings > Editor.

I'm trying to use the UnityEditor.VersionControl.Provider functions found here: http://docs.unity3d.com/Documentation/ScriptReference/VersionControl.Provider.html

Almost every one of these returns a Task: http://docs.unity3d.com/Documentation/ScriptReference/VersionControl.Task.html

Which has a "success" variable.

I am first checking whether the provider is ready and enabled using:

bool providerEnabled = Provider.enabled && Provider.isActive;

Which returns True. However, ALL my actions I attempt return a Task with a failed success state. I have not been able to get information about my ChangeSets, for example.

I have been able to checkout files from code, like this:

if (providerEnabled) Provider.Checkout(targetPrefab, CheckoutMode.Both);

Which works... but the Task returned for that operation says it failed! The files do successfuly get checked out in my Default changelist. I am unable to add/move files around to specific changelists though because Provider.ChangeSets and Provider.ChangeSetStatus() never return anything but a failed Task.

Does anyone know what's going on? Could it be that Unity and the P4V client became incompatible at some point?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by dbarth · May 15, 2014 at 06:19 AM

I've figured it out and will leave the answer here in case anyone else runs into this issue.

After every action that returns a task, you need to use Task.Wait() before performing another action. Otherwise, I'm assuming you're attempting Perforce actions too quickly and the first one will generally succeed while the rest will be denied.

Example:

// Check out a file

Task checkoutTask = Provider.Checkout(Selection.activeObject, CheckoutMode.Both);

checkoutTask.Wait();

// Query changelist for status (returns a Task containing an asset list)

Task statusTask = Provider.ChangeSetStatus("49971");

statusTask.Wait();

// Should both print "True"

Debug.Log("Checkout success: " + checkoutTask.success);

Debug.Log("Changelist status success: " + statusTask.success);

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image segafreak1999 · Aug 27, 2014 at 11:35 PM 0
Share

Thanks for leaving this here! It was very helpful to me and fixed my problem - evidently the same one!

avatar image
0

Answer by GearKlik · Aug 14, 2017 at 11:12 PM

OMFG thank you for pointing out the Wait function

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

21 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Camera rotate and move follow Player 1 Answer

Microsoft Visual C# Compiler error 0 Answers

How to use a boolean to control another object boolean using C# script 4 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges